Addition Digits in c Program
#include<stdio.h>
int main()
{
int a,b,c,d=0;
scanf("%d",&a);
b=a;
while(b!=0)
{
c=b%10;
d=d+c;
b=b/10;
}
printf("The addtion digits of values %d:%d",a,d);
return 0;
}
printf("Enter the Numbers:");
Output
Enter the numbers: 3456
The addition of values 3456:18
No comments:
Post a Comment