a program in c language to find the sum of all digits of a given number using while loop with detail explanation.

Output
Enter a number
421
Sum of digits of the number 421 is 7


Explanation
1.Take an integer as input and store it in the variable n.
2.Set the value of the variable to zero.
3.Divide the entered integer by 10 and get the remainder and the quotient.
4.Store the remainder in the rem variable.
5.Increase the sum of the variable with the variable rem.
6.Store the quotient in the variable n.
7.This process is repeated until the number becomes 0.
8.Print the changed amount as output and exit.


Previous :-->> 14. Write a program in c language to check if a given number is a palindrome or not using a while loop.
 -->> NEXT: 16.Write a program in c to print the pattern of a hollow square using a while loop.
-->>ALL Loops Assignments in c