Advertisement
rotti321

Testare palindrom

Jan 4th, 2022
853
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n,x,inv=0,cif;
  7.     cin >> n;
  8.     x=n;
  9.     while(n!=0){
  10.         cif=n%10;
  11.         n=n/10;
  12.         inv=inv*10+cif;
  13.     }    
  14.     if(inv==x){
  15.         cout << "PALINDROM";
  16.     }
  17.     else{
  18.         cout << "N NU ESTE PALINDROM";
  19.     }
  20.     return 0;
  21. }
Advertisement
RAW Paste Data Copied
Advertisement