#include<stdio.h>
int main(){
int c, sum,t;
char n[1000];
printf("Input an integer\n");
scanf("%s", n);
sum = c = 0;
while(n[c]!='\0'){
t = n[c]-'0';
sum=sum+t;
c++;
}
printf("Sum of digits of %s = %d\n", n, sum);
return 0;
}
????
#include<stdio.h>
int main(){
int c, sum,t;
char n[1000];
printf("Input an integer\n");
scanf("%s", n);
sum = c = 0;
while(n[c]!='\0'){
t = n[c]-'0';
sum=sum+t;
c++;
}
printf("Sum of digits of %s = %d\n", n, sum);
return 0;
}
????
스트링으로 입력받은 다음에 첫자리부터 끝자리까지 돌리면서 인트로 변환해서 더하셈
아니면 승리의 64비트 정수