Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <math.h>
- int main() {
- int num;
- int sum = 0;
- int temp = 0;
- while(scanf("%d", &num) != EOF) {
- while(num != 0) {
- temp = num%10;
- sum += temp;
- num = num/10;
- }
- }
- printf("Sum: %d\n", sum);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement