Skip to content

Commit dafb1a0

Browse files
committed
12palindrome
1 parent 4e805b9 commit dafb1a0

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Programs/DSA/palin.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
12. WAP in Js Function Check Pallindrome
3+
Number
4+
5+
Input - 121
6+
Output -Pallindrome
7+
8+
*/
9+
10+
11+
function checkpalindrome(num) {
12+
13+
let s = 0, r, n
14+
n = num
15+
while (num > 0) {
16+
17+
r = num % 10
18+
s = s * 10 + r
19+
num = Math.floor(num / 10);
20+
}
21+
if (s == n) {
22+
console.log("The number is Pallindrome = ", s)
23+
} else {
24+
console.log("The number is not Pallindrome ", s)
25+
}
26+
}
27+
28+
checkpalindrome(121)
29+
checkpalindrome(236)

0 commit comments

Comments
 (0)