程序纠错,大侠们帮忙
#include<stdio.h> int main()
{
int num,n=1;
int i,j,m,w,t;
int count=0;
scanf("%d",&num);
m=num;
t=num;
while((m=m/10)!=0)
n++;
for(i=0;i<n;i++)
{
j=num%10;
num=num/10;
count+=j;
w=j+w*10;
}
printf("the reverse of the %d is %d",t,w);
printf("\n");
printf("the sum of the %d is %d",t,count);
}
应该是输入任意整数,就能打印出它的逆序数和各位之和,上面的程序对4位以下的整数都能正常处理,但是4位以上就不对了,达人们帮帮忙吧!!!