#include<stdio.h>
#include<conio.h>
void main()
{
int num,rem,sum=0;
clrscr();
printf("\n enter the number");
scanf("\n %d",&num);
while(num>0)
{
rem=num%10;
sum=sum+rem;
num=num/10;
}
printf("\n sum is %d",sum);
getch();
}
#include<conio.h>
void main()
{
int num,rem,sum=0;
clrscr();
printf("\n enter the number");
scanf("\n %d",&num);
while(num>0)
{
rem=num%10;
sum=sum+rem;
num=num/10;
}
printf("\n sum is %d",sum);
getch();
}