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