解题思路:
三位数除100得到百位数字
三位数减去百位数得到十位数, 然后再除10得到十位数.
个位数就等于三位数减去百位数再减去十位数.
注意事项:
无
参考代码:
#include <stdio.h> int main() { int num,x,y,z; scanf("%3d", &num); x = num/100; y = (num - x*100)/10; z = num-x*100-y*10; printf("%1d %1d %1d\n", z,y,x); return 0; }
0.0分
7 人评分
#include <stdio.h> int main() { int n,i,j,k; scanf("%d",&n); i=n/100; j=(n-i*100)/10; k=n%10; printf("%d %d %d",k,j,i); return 0; }
# include <stdio.h> int main() { int a; printf("please enter the number:\n"); scanf("%d", &a); int b = a%10; int c = a/100; int d = (a-(100*c)-b)/10; printf("The reverse of number is:%d %d %d",b,d,c); return 0; }
#include <stdio.h> int main() { int a,c; scanf("%d",&a); c=a%10; printf("%d ",c); a=a/10; c=a%10; printf("%d ",c); a=a/10; c=a%10; printf("%d\n",c); return 0; }
为什么要用%ld