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)
- //Coding by: Snehil Khanor
- //http://WapCPP.blogspot.com
- {
- 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();
- }
4 comments:
its not working bro....
try a different program....
thanks man....
its a good program.. i found another here which also works
find palindrome number in c++
Post a Comment