Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n,r1,r2,r3,r4,r5,sum;
  6. cout<<"enter the 5 digit number:"<<endl;
  7. cin>>n;
  8. r1=n%10;
  9. n=n/10;
  10. r2=n%10;
  11. n=n/10;
  12. r3=n%10;
  13. n=n/10;
  14. r4=n%10;
  15. n=n/10;
  16. r5=n%10;
  17. n=n/10;
  18. sum=r1+r2+r3+r4+r5;
  19. cout<<"sum of entered number :"<<endl<<sum;
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement