求大神解答
#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);
}
核心思想是求出四位数的各位数,再用printf进行倒着输出