Input a set of number that summation of every digits in reversed type
#include<stdio.h>
#include<stdlib.h>
int main(){
int num4,sum;
int a,b,c,d;
printf("My goddness:");
while(scanf("%d",&num4) != EOF){
a=0,b=0,c=0,d=0; //Initialize the variable,set zero
a=num4%10;
b=(num4/10)%10;
c=(num4/100)%10;
d=(num4/1000)%10;
sum=a+b+c+d;
printf("%d+%d+%d+%d==%d",a,b,c,d,sum);
}
return 0 ;
}
全站熱搜
留言列表