-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathDevanshMalik_Cse_II.cpp
More file actions
47 lines (38 loc) · 889 Bytes
/
Copy pathDevanshMalik_Cse_II.cpp
File metadata and controls
47 lines (38 loc) · 889 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
Solve the below mentioned task and push the code to your branch,
Do Not the push the code to your branch
You can change the file and complete the task in any language
Given an integer x, return true if x is a palindrome, and false otherwise.
Example 1:
Input: x = 121
Output: true
Explanation: 121 reads as 121 from left to right and from right to left.
Example 2:
Input: x = 10
Output: false
Explanation: Reads 01 from right to left. Therefore it is not a palindrome.
*/
#include<iostream>
using namespace std;
int main()
{
int num,rev=0,mod;
cout<<"Enter any Integer:"<<endl;
cin>>num;
int original=num;
while(num!=0)
{
mod=num%10;
rev=rev*10+mod;
num=num/10;
}
if(original==rev)
{
cout<<"It is a PALINDROME number";
}
else
{
cout<<"It is NOT a PALINDROME number";
}
return 0;
}