编写一个程序,从键盘输入一个三位整数,将它们逆序输出。例如输入127,输出721

如题所述

#include<stdio.h>
#include<math.h>
int main()
{ int number,digit;
scanf("%d",&number);
while(number!=0)
{
digit=number%10;
printf("%d",digit);
number/=10;
};
return 0;
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-04-24
char str1[3];
scanf("%s",str1);
char temp;
temp = str1[0];
str1[0] = str1[2];
str1[2] = temp;
printf("%s\n",str1);本回答被提问者采纳