write a program in c language to print sum of number
Answers
Answered by
2
Answer:
- int main() { int n, t, sum = 0, remainder;
- printf("Enter an integer\n"); scanf("%d", &n);
- t = n;
- while (t != 0) { remainder = t % 10; sum = sum + remainder; t = t / 10; }
- printf("Sum of digits of %d = %d\n", n, sum);
- return 0; }
Answered by
0
Search on YouTube you will find but tutorials for C language and other computer language
Similar questions