Advertisement
rahat62

Input Interger and check palindome << int to string << String Reverse

Feb 28th, 2024 (edited)
738
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main(){
  4.     int n;
  5.     cin>>n;
  6.     string strNum = to_string(n);
  7.     string s= strNum;
  8.     reverse(strNum.begin(),strNum.end());
  9.     if(strNum == s){
  10.         cout<<"P"<<endl;
  11.     }
  12.     else
  13.         cout<<"NP"<<endl;
  14.  
  15.  
  16. }
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement