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
What's relationship between JavaScript and ECMAScript? And What are JavaScript types?
What is the importance of javascript?
What are two-way data binding and one-way data flow, and how are they different?
What are the limitations of javascript?
How do you check if an object is an array or not?
How to comment javascript code?
How to hide javascript code from old browsers that dont run it?
What does the following statement declares?
Explain the term closure?
What is the most popular javascript library?
How do you write an if statement in javascript?
just for testing
What is a function callback?
How do you check if a value is a number in javascript?
Explain the different types of pop-up boxes you can create in JavaScript.