Wednesday, October 19, 2011

Program:To check if a number is palindrome or not




#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c=0,temp;
cout<<"enter the number : ";
cin>>a;
temp=a;
while(temp>0)
{
b=temp%10;
temp=temp/10;
c=c*10+b;
}
if(a==c)
cout<<"palindrome";
else
cout<<"not palindrome";
getch();
}

Article by
Chief-Editor

He is a tech Enthusiast, an Altruist and calm mentor. He loves to code. He is also a creative graphic designer. Do check out his designfolio @ Jasmeet.asia If you like This post, you can follow me on Twitter.



For Further Reading,
C++ Program

0 comments:

Post a Comment