palindrome

PHOTO EMBED

Mon Feb 27 2023 15:00:21 GMT+0000 (Coordinated Universal Time)

Saved by @kavishri

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