C++ program : How to check waether the Number is Palindrome or Not






C++ program : How to check waether the Number is Palindrome or Not :


#include <iostream>

using namespace std;




int main()
{
int n,temp,rev = 0;
cout << "Enter the Number to check it is Palindrome or Not : " << endl;
cin >> n;
temp = n;
while (temp !=0)
{
rev = rev * 10;
rev = rev + temp % 10;
temp = temp / 10;
}
if (n == rev)
cout << n << " is Palindrome" << endl;
else
cout << n << " is not a Palindrome" << endl;
return 0;
}


Output : 

C++ program : How to check waether the Number is Palindrome or Not
C++ program : How to check waether the Number is Palindrome or Not
C++ program : How to check waether the Number is Palindrome or Not C++ program : How to check waether the Number is Palindrome or Not Reviewed by Awais Shah on 19:53:00 Rating: 5

1 comment:

  1. Very Nice and Informative Code. Thanks
    Regards Pinoy Tv Shows http://www.pinoytvshows.me

    ReplyDelete

Powered by Blogger.