Searching...
Friday, 22 July 2016

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

19:53:00





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
Newer Post
Previous
This is the last post.

1 comments:

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

    ReplyDelete