Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int n,r1,r2,r3,r4,r5,sum;
- cout<<"enter the 5 digit number:"<<endl;
- cin>>n;
- r1=n%10;
- n=n/10;
- r2=n%10;
- n=n/10;
- r3=n%10;
- n=n/10;
- r4=n%10;
- n=n/10;
- r5=n%10;
- n=n/10;
- sum=r1+r2+r3+r4+r5;
- cout<<"sum of entered number :"<<endl<<sum;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement