.
Home About-us Privacy Policy Contact-us Services

Wednesday, October 7, 2015

C++ Program To Find Or Check Number is Palindrome or not

ad+1

This Program Takes Integer From end user and integer is reversed. if reversed integer equal to entered user integer then that number is palindrome another wise number is not palindrome.








Program -

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

Output - 
 
enter the number: 212
212 is palindrome

enter the number: 567
567 is not palindrome

0 comments:

Post a Comment

Home About-us Privacy Policy Contact-us Services
Copyright © 2014 All Programs Examples | All Rights Reserved. Blogger Templates Download Blogger Templates