- Home
- Course Category
- Course Result
- Course Detail
Hot Line: 0124-2383121
Course Introduction
Programs for practice
Take a number from user Check if it is Palindrome or Not in C++
Source Code:Check Palindrome or Not
/* C++ Program - Check Palindrome or Not */
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int num, orig, rev=0, rem;
cout<<"Enter a number : ";
cin>>num;
orig=num;
while(num>0)
{
rem=num%10;
rev=rev*10+rem;
num=num/10;
}
if(orig==rev)
{
cout<<"It is Palindrome";
}
else
{
cout<<"It is not Palindrome";
}
getch();
}
Output
Enter a number: 121
It is Palindrome