Search & Find out

Sunday, December 6, 2009

PALINDROME



#include "iostream.h"
#include "conio.h"
class demo
{
    private:
        int n,N,q,r,R;
    public:
        void cal ();
 };
void demo :: cal ()
{
    cout << "Enter the Number: ";
    cin >> n;
    if(n<=0)
    cout << "The is invalid\n";
    else
    {
    N = n;
    for (R = 0; n > 0;)
    {
        q = n/10;
        r = n%10;
        R = (R*10)+r;
        n = q;
    }
    if (R == N)
        cout << "The number is a Palindrome Number!";
    else
        cout << "The number is not a Palindrome Number!";
    }
 }
void main ()
{
    demo d;
    clrscr ();
    cout<< "Welcome to Palindrome no.\n\n";
    d.cal ();
getch ();
}



Get the executable ( .exe ) file for this program..
Download

0 comments:

Post a Comment

 

My Blog List

Term of Use