WAP to input a number and print sum of its digit.
Answers
Answered by
4
The program output is also shown below.
* C program to accept an integer & find the sum of its digits.
long num, temp, digit, sum = 0;
printf("Enter the number \n");
scanf("%ld", &num);
temp = num;
while (num > 0)
digit = num % 10;
sum = sum + digit;
Similar questions
Math,
4 months ago
Math,
4 months ago
Hindi,
9 months ago
Social Sciences,
1 year ago
Hindi,
1 year ago