Wednesday, July 29, 2020

Write a Program find Palindrome or Not in C++.

Palindrome or Not in C++.


#include <iostream>
using namespace std;
int main()
{
int n,s,sum=0,temp;
cout<<"Enter the Number=";
cin>>n;
temp=n;
while(n>0)
{
s=n%10;
sum=(sum*10)+s;
n=n/10;
}
if(temp==sum)

cout<<"Number is Palindrome :";
else
cout<<"Number is not Palindrome :";
return 0;
}


OUTPUT

Enter the Number=121
Number is Palindrome.

No comments:

Post a Comment

Please do not any spam link in Comment Box