W.A.P. C++

WAP | CPP | Programs in C++ | C++ Solutions

write a program to check whether entered number is palindrome or not


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 :)
  1. #include<iostream.h>
  2. #include<conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. long int n,rev=0,m,num;
  7. cout<<"please enter a five digit no.: ";
  8. cin>>n;
  9. num=n;
  10. while(n>0)
  11. //Coding by: Snehil Khanor
  12. //http://WapCPP.blogspot.com
  13. {
  14. m=n%10;
  15. rev=rev*10+m;
  16. n=n/10;
  17. }
  18. cout<<rev<<endl;
  19. if (num==rev)
  20. cout<<"Number is a palindrome";
  21. else
  22. cout<<"Not a palindrome";
  23. getch();
  24. }

5 comments:

Computer C++ Programs September 13, 2011 at 9:50 PM  

its not working bro....

Computer C++ Programs September 13, 2011 at 9:51 PM  

try a different program....

Anonymous November 28, 2012 at 8:17 PM  

thanks man....

Anonymous September 18, 2013 at 3:38 AM  

its a good program.. i found another here which also works

find palindrome number in c++

Hitesh Kumar December 13, 2015 at 1:07 AM  

Palindrome Number Program in C++

A Palindrome number is a number that remains the same when its digits are reversed. Like 16461, for example: we take 121 and reverse it, after revers it is same as original.

Search

About WAP C++

Here you'll find a wide range of programs' solution ranging from beginer level to advanced level.
All programs here are made, compiled and tested by me..and are running absolutely fine.. still if you find any bug in any program do let me know :)

Followers

Subscribe via email

Enter your email address:

Delivered by FeedBurner

my Binary Log

Blog Archive



eXTReMe Tracker