#include "stdio.h''
#include ''conio.h''
main() {
signed long int num,sum=0,digit;
printf("enter digits = ");
scanf("%ld",&num);
while(num%10) {
digit=num%10;
sum+=digit;
num/=10;
}
printf("Digit sum = %ld",sum);
getch();
}
OUTPUT : -
enter digits = 123
Digit sum = 6
enter digits = 123456789
Digit sum = 45
r u unable to understand this program??????????TRY THESE
1. Email us at chelperr@gmail.com
2. Post your question in the comment box.
3. You can give us your email ID also.
No comments:
Post a Comment