forked from Arunb-lab1/Hacktoberfest2022
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPalindrome.cpp
More file actions
24 lines (23 loc) · 893 Bytes
/
Palindrome.cpp
File metadata and controls
24 lines (23 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//WAP to check whether a number is palindramic or not
#include<iostream>
using namespace std;
int main()
{
int n,m,l=0,f;
cout<<"Enter the number: ";
cin>>n;
f=n; //assigning value of n to a different variable since n will
while (n>0) //take other values
{
m = n%10; //m will store remainder
l = l*10 + m; //l will store the number in reverse
n = n/10; //n will store the value of Quotient
}
cout<<"It's Reverse is "<<l<<endl;
if(l==f)
{cout<<f<<" is Palindrome"<<endl;
}
else
{cout<<f<<" is not palindrome";}
return 0;
}