We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b15c30c commit 717e76aCopy full SHA for 717e76a
palindrome.cpp
@@ -0,0 +1,33 @@
1
+#include<iostream>
2
+
3
+using namespace std;
4
5
+ bool isPalindrome(int x) {
6
+ if(x < 0)
7
+ {
8
+ return false;
9
+ }
10
+ long n = x;
11
+ long Num = 0, rem;
12
+ while(x != 0)
13
14
+ rem = x%10;
15
+ Num = (Num*10)+rem;
16
+ x /= 10;
17
18
19
+ if(Num == n)
20
21
+ return true;
22
23
24
+}
25
+ int main()
26
27
+ int x=161;
28
+ int c=isPalindrome(x);
29
+ if(c==0)
30
+ {cout<<"false";}
31
+ else{cout<<"true";}
32
+ return 0;
33
0 commit comments