sum of each digit

*/ except one no from user and display sum of each digit */

#include
#include

void main()
{
int no,d,sum=0;
clrscr();
printf("\n Enter The No :- ");
scanf("%d",&no);
while(no>0)
{
d=no%10;
no=no/10;
sum=sum+d;
}
printf("\n The Sum Digit :- %d",sum);
getch();
}

0 comments:

Post a Comment