求四位数得倒着输出
求大神解答
#include <stdio.h>
void main()
{
int x, a, b, c, f, z,sum;
printf ("input x");
scanf ("%d", &x);
a = x / 1000;
f = x % 10;
b = (x - a * 1000) / 100;
c = (x - a * 1000 - b * 100) / 10;
z = f * 1000 + c * 100 + b * 10 + a * 1;
sum = a + b + c + f;
printf("a=%d, b=%d, c=%d, f=%d, z=%d, sum=%d",a, b, c, f, z,sum);
}
举报