Advertisement
rony-Rony_05

problem 4

Jun 21st, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.19 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int temp,n,sum=0,re;
  5. scanf("%d",&n);
  6. temp=n;
  7. while(temp!=0)
  8. {
  9. re=temp%10;
  10. sum=sum+re;
  11. temp=temp/10;
  12. }
  13. printf("sum of all digit=%d",sum);
  14. return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement