Friday 31 January 2014

Finding Palindrome C++ Code

Posted by viralnom  |  at  21:46 No comments


  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int palindrome, reverse=0;
  6.     cout<<"Enter number:  ";
  7.     cin>>palindrome;
  8.     int num=0,key=palindrome;
  9.   for(int i=1;palindrome!=0;i++){

  10.     num=palindrome%10;
  11.     palindrome=palindrome/10;
  12.     reverse=num+(reverse*10);
  13.               }

  14.    if(reverse==key){
  15.       cout<<key<<" is a Palindrome Number";
  16.             }
  17.    else{
  18.       cout<<key<<"is NOT a Palindrome Number";
  19.             }
  20. return 0;
  21. }

Tags:
About the Author

Write admin description here..

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

Related posts

0 comments:

ExactSeek Approved !!

Blogger templates. Proudly Powered by Blogger.
back to top