Palindrom Number in C++ Programming Language
#include<iostream.h>
#include<conio.h>
class pali
{
private:
int no;
public:
void getdata();
void putdata();
};
void pali :: getdata()
{
cout<<"Enter Number for check palindrom OR not:->";
cin>>no;
}
void pali :: putdata()
{
int a,s=0,b;
b=no;
while(no>=1)
{
a=no%10;
s=(s*10)+a;
no=no/10;
}
if(s==b)
{
cout<<"The number is a Plindrom"<<endl;
}
else
{
cout<<"The number is not Palindrom"<<endl;
}
}
void main()
{
clrscr();
pali p;
p.getdata();
p.putdata();
getch();
}
#include<conio.h>
class pali
{
private:
int no;
public:
void getdata();
void putdata();
};
void pali :: getdata()
{
cout<<"Enter Number for check palindrom OR not:->";
cin>>no;
}
void pali :: putdata()
{
int a,s=0,b;
b=no;
while(no>=1)
{
a=no%10;
s=(s*10)+a;
no=no/10;
}
if(s==b)
{
cout<<"The number is a Plindrom"<<endl;
}
else
{
cout<<"The number is not Palindrom"<<endl;
}
}
void main()
{
clrscr();
pali p;
p.getdata();
p.putdata();
getch();
}
Palindrom Number in C++ Programming Language
Reviewed by Unknown
on
6:20:00 PM
Rating:
No comments: