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 is the difference between window & document in javascript?
Which software is used for javascript?
What is the result of below given line of code in java script? 5+4+'7'?
Explain javascript debounce function?
What is the function of delete operator?
What is difference between module.exports and export?
How many data types are there in javascript?
What is new function in javascript?
What's relationship between JavaScript and ECMAScript? And What are JavaScript types?
What is array explain it?
What is function overloading in javascript?
Is jquery easier than javascript?
What are javascript functions?
Does javascript have the concept level scope?
How do I turn off javascript in chrome?