Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int a, s;
- printf("Enter value of a: ");
- scanf("%d",&a);
- s = 0;
- while(a > 0)
- {
- s = s + (a%10);
- a = a / 10;
- }
- printf("Sum of digits: %d",s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement