#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,sum=0;
clrscr();
printf("Enter any number = ");
scanf("%d",&n);
while(n>0)
{
sum=sum+n%10;
n=n/10;
}
printf("Sum of digit = %d",sum);
getch();
}
///////////////////////////////////////////////////////////////////////////
Copy & paste this code in your TC & run, then you will get output.......
If you have any problem please comment below.........