Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int n,temp,sum=0,r,count=0,i=1;
- cin>>n;
- temp=n;
- while(temp!=0)
- {
- // sum = 0;
- r = temp % 10;
- sum = sum*10 + r;
- temp = temp/10;
- count++;
- cout<<i++<<"th "<<"digit:"<<r<<"\n";
- }
- cout<<"sum:"<<sum<<endl;
- if(n==sum)
- {
- cout<<"palindrome\n";
- }
- else {
- cout<<"not palindrome\n";
- }
- cout<<"total digit"<<count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement