题目:C语言 输入一个字符串,统计字符个数,并按照倒序输出该字符串。
#include
void main() {
char str[10];
scanf("%s", str);
int i = 0, k = 0, count = 0;
while(i0) {
count++;
}
printf("%c ",str[i]);
i++;
}
//字符的个数
printf("字符的个数为:%d\n",count);
//倒序输出
for(int j = k;j>=0;j--) {
printf("%c ",str[j]);
}
}
运行结果: