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
Can webassembly replace javascript?
What is a null variable?
Do hackers use javascript?
How you will add function as a property in a javascript object? Give an example.
What is local scope in javascript?
What does two exclamation marks mean in javascript?
What is a scope in javascript?
How we can add title of the page by javascript?
In Java coding we will write a public static void main()? Why won't we write as a static public void main()
How to achieve inheritance in javascript?
Explain the for-in loop?
What is event bubbling in JavaScript?
What is the difference between .call() and .apply()?
How to get value from a textbox?
Which javascript framework is in demand?