You are on page 1of 1

A palindrome is a number or a text phrase that reads the same

backwards as forwards, For Example, each of the following five digit


number is a palindrome 12321, 55555, 45554, 11611. Write a program
that reads in a five digit integer and determines whether it is a
palindrome or not?(Hint: Use Modulus and Division operator to separate
the numbers)
============================================
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();

long int no,first,second,third,fourth,fifth;

cout<<"Enter the Five Digit no = ";


cin>>no;

first=no/10000;
no=no%10000;
second=no/1000;
no=no%1000;
third=no/100;
no=no%100;
fourth=no/10;
no=no%10;
fifth=no;

if(first==fifth&&second==fourth)
cout<<"\nIt is a Palindrome Number "<<"\n";
else
cout<<"\nIt is not a Palindrome Number ";
getch();
}

http://www.ravianeducation.blogspot.com
FARHAN: 03008855006