Skip to main content

Featured

functions in Python

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();
}

Comments

Popular Posts