Featured
- Get link
- X
- Other Apps
C++ program to check a number for palindrome
//program to check whether a number is palindrome or not
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n,x,rev=0,rem;
cout<<"\nEnter a number\n";
cin>>n;
x=n;
while(x>0)
{
rem=x%10;
rev=rev*10+rem;
x=x/10;
}
if(n==rev)
cout<<"Palindrome Number";
else
cout<<"Not a palindrome number";
getch();
}
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n,x,rev=0,rem;
cout<<"\nEnter a number\n";
cin>>n;
x=n;
while(x>0)
{
rem=x%10;
rev=rev*10+rem;
x=x/10;
}
if(n==rev)
cout<<"Palindrome Number";
else
cout<<"Not a palindrome number";
getch();
}
Popular Posts
C++ program to display numbers which get reversed after multiplying by 4
- Get link
- X
- Other Apps
Comments
Post a Comment