Program to Check the number is whether palindrome or not | C++ Programming
Tuesday, August 11, 2020
//Program to Check the number is whether palindrome or not
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{clrscr();
long num,res=0,ori,c;
cout<<"\n Enter the number:";
cin>>num;
ori=num;
while(num>0)
{
c=num %10;
res=res*10+c;
num=num/10;
}
if(ori==res)
cout<<"\n The entered number is palindrome";
else
cout<<"\n The entered number is not palindrome";
getch();
}
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{clrscr();
long num,res=0,ori,c;
cout<<"\n Enter the number:";
cin>>num;
ori=num;
while(num>0)
{
c=num %10;
res=res*10+c;
num=num/10;
}
if(ori==res)
cout<<"\n The entered number is palindrome";
else
cout<<"\n The entered number is not palindrome";
getch();
}


0 Comments