What is the purpose of the given program? n is the input number given by
the user.
#include <stdio.h>
int main()
{
int n, x=0.Yi
printf("Enter an integer: ');
scanf("%d", &n);
while (n !=0)
y=n% 10;
x=x+y;
n = n/10:
}
printf("Output is = %d", x);
return 0:
}
a) Sum of the digits of a number
b) Sum of the factorial of individual digits in a number
c) Reverse of a number
d) The same number is printed
Answers
Answered by
1
Answer:
Sum of the digits of a number
Explanation:
Walk through the code
--------------
Enter an integer: 189
Output is = 18
-----------------------
Enter an integer: 1829
Output is = 20
Similar questions