JavaScript Program to check given number is palindrome or not ? (12)
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
let n =parseInt(prompt("Enter a number"));
let m=n;
document.write("Given number is :"+n);
let p = 0;
while(n>0)
{
r = n%10;
p = p*10 + r;
n = Math.floor(n/10);
}
if(p==m)
{
document.write("<br> Palindrome Number");
}
else
{
document.write("<br> Not Palindrome Number");
}
</script>
</body>
</html>
Comments
Post a Comment