this program.
Program
#include<stdio.h>
#include<conio.h>
void main()
{
int
n,rem,sum=0;
printf("Enter
the number:");
scanf("%d",&n);
do {
rem=rem%10;
n=n/10;
sum=sum+rem;
}
while(n>0);
printf("Sum of digits of number entered by user:%d\n",sum);
}
Output:
Post a Comment