C++ program : To check whether a given number is palindrome or not


Posted Date:     Total Responses: 0    Posted By: K Dinesh Reddy   Member Level: Gold   Points/Cash: 7   




//C++ program : To check whether a given number is palindrome or not

#include
using namespace std;
int main()
{
int n, num, digit, rev = 0;
cout << "Enter a positive number: ";
cin >> num;
n = num;
do
{
digit = num%10;
rev = (rev*10) + digit;
num = num/10;
}while (num!=0);
cout << " The reverse of the number is: " << rev << endl;
if (n = = rev)
cout << " The number is a palindrome";
else
cout << " The number is not a palindrome";

system("pause");
return 0;
}




Note: In the program, After #include "iostream" tag is there...
But it is not seen as the post is considered as a HTML post...
So please don't forget this point...
The original file is uploaded as attachment...
Check that also...



With Regards,
ZORO
IIT Madras - CSE




Attachments

  • To check whether a given number is palindrome or not (2088-3190-To check whether a given number is palindrome or not.txt)

  • Project Feedbacks

    Author: Member Level: BronzeRevenue Score: 1 out of 5
    wonderful program completely basic and well written.....thanks...!!!!:-)


    Post Feedback
    You must Sign In to post a feedback.
    Next Project: C++ program : To compute the sum of reciprocals
    Previous Project: C++ program : TO DEMONSTRATE NESTED LOOP

    Return to Project Index

    Post New Project


    Related Projects


    Complete the action items below to enter to win an iPad Mini from India Study Channel! in India Study Channel - Locker on LockerDome
    Awards & Gifts
    Active Members
    TodayLast 7 Daysmore...

     
    ISC Technologies, Kochi - India. © All Rights Reserved.