Write a program to check whether a given number is a
palindrome or not?
Answer Posted / ankita
//Program to check the given number is palindrome or not//
<html>
<head>
<script language="javascript">
var num,n,rev=0,r;
num=prompt("Enter the number");
n=num;
while(parseInt(num)>0)
{
r=parseInt(num)%10;
rev=parseInt(rev)*10+parseInt(r);
num=parseInt(num)/10;
}
if(rev==parseInt(n))
document.write(n+ " is a palindrome number");
else
document.write(n+ " is not a palindrome number");
</script>
</head>
<body>
</body>
</html>
| Is This Answer Correct ? | 8 Yes | 2 No |
Post New Answer View All Answers
just for testing
List the comparison operators supported by javascript?
What is the meaning of callback function?
How to create a popup warning box?
What is asynchronous javascript?
Explain “use strict” ?
How to add behavior to an element using javascript?
What is an example of javascript?
What does === mean in js?
how to write frame work Architecture in QTP
Is notepad ++ an ide?
Write a program to exaplain the deferred scripts using event handlers in javascript.
What are javascript closures?when would you use them?
How to use "join()" to create a string from an array using javascript?
What is a frontend framework?