Write a program to find the sum of digit of the number using while loop

include<stdio.h> void main() { int n,sum=0,last; printf("Enter any number: "); scanf("%d",&n); while(n>=10) { last=n%10; sum+=last; n/=10; } sum+=n; printf("The Sum of digits is %d",sum); }

**Output**

Enter any number: 234

The Sum of digits is 9

**Behind the scene**

2 + 3 + 4 = 9