0% found this document useful (0 votes)
35 views2 pages

Palindrome NO

This C++ program takes a user-input number as input, reverses the number, and compares it to the original to check if it is a palindrome. It uses modulo and division operations in a while loop to extract the ones, tens, hundreds digits of the number and build the reversed number. It then prints whether the original and reversed numbers are equal, identifying the number as a palindrome or not.

Uploaded by

Moin Ud deen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views2 pages

Palindrome NO

This C++ program takes a user-input number as input, reverses the number, and compares it to the original to check if it is a palindrome. It uses modulo and division operations in a while loop to extract the ones, tens, hundreds digits of the number and build the reversed number. It then prints whether the original and reversed numbers are equal, identifying the number as a palindrome or not.

Uploaded by

Moin Ud deen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Palindrome NO.

Program

# include <iostream>

using namespace std;

int main()

int num;

int rev=0;

int a;

cout<<"please enter the num"<<endl;

cin>>num;

int x=num;

while(num>0)

a=num%10;

rev=rev*10+a;

num=num/10;

if(x==rev)

cout<<"the num is palindrome"<<endl;

else

cout<<"not palindrome"<<endl;

}
system("pause");

return 0;

You might also like