Palindrome :A word or phrase that reads the same backward as forward
A number is taken from user and then checks if the entered number is palindrome or not.
Select To use this code as it is.. select and copy paste this code into code.cpp file
- #include<iostream.h>
- #include<conio.h>
- void main()
- {
- clrscr();
- long int n,rev=0,m,num;
- cout<<”please enter a five digit no.: “;
- cin>>n;
- num=n;
- while(n>0)
- {
- m=n%10;
- rev=rev*10+m;
- n=n/10;
- }
- cout<<rev<<endl;
- if (num==rev)
- cout<<”Number is a palindrome”;
- else
- cout<<”Not a palindrome”;
- getch();
- }