marius7122

Untitled

Jul 9th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5. int n, inv, cop;
  6.  
  7. int main ()
  8. {
  9.     cout<<"n= "; cin>>n;
  10.  
  11.     cop = n;
  12.  
  13.     while(n > 0)
  14.     {
  15.         inv = inv * 10 + n % 10;
  16.  
  17.         n = n / 10;
  18.     }
  19.  
  20.     if(inv == cop)
  21.         cout<<" n este palindrom "<<endl;
  22.  
  23.     else
  24.         cout<<" n nu este palindrom "<<endl;
  25.  
  26.     return 0;
  27. }
Add Comment
Please, Sign In to add comment