Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int num,temp,re,sum=0;
- scanf("%d",&num);
- temp=num;
- while(temp!=0)
- {
- re=temp%10;
- sum=sum+re;
- temp=temp/10;
- }
- printf("sum of all digit = %d\n",sum);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement