#include<stdio.h>
void main()
{
int no,m,sum;
clrscr();
sum=0;
printf("\tenter your value for get sum of digit");
scanf("%d",&no);
while(no>0)
{
m=no%10;
sum=sum+m;
no=no/10;
}
printf("\tsum of your value%d",sum);
getch();
}
void main()
{
int no,m,sum;
clrscr();
sum=0;
printf("\tenter your value for get sum of digit");
scanf("%d",&no);
while(no>0)
{
m=no%10;
sum=sum+m;
no=no/10;
}
printf("\tsum of your value%d",sum);
getch();
}
No comments:
Post a Comment