Thursday, 20 December 2012

how to find that the given number is a palindrome


This is the source code to find that the given number is palindrome or not........

#include<iostream.h>
#include<conio.h>
main()
{
      int number,a,b,c,d,e,f,g,h,mango;
      cout<<"Ente the five digit number:";
      cin>>number;
      cout<<endl;
      mango=number/10000;
      a=number%10000;
      b=a/1000;
      c=a%1000;
      d=c/100;
      e=c%100;
      f=e/10;
      g=e%10;
      cout<<mango<<b<<d<<f<<g<<endl;
      if(mango==g && b==f)
      cout<<"number is palindrom";
      else
      cout<<"number is not a palindrom";
      getch();
}
End
     

No comments:

Post a Comment