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 do you mean by script?
What is the use of 'bind' method in JavaScript?
wap to accept an int array frm the user and print the lucky nos.
How to convert json object to string?
How compare function works javascript?
What is differential inheritance?
What is a closure in javascript?
What is question mark in javascript?
What are the data types supported by javascript?
What does three dots mean in texting?
What is a boolean search?
The below script is working Internet browser but not working in mozilla plz find that good way... function doSubmit(op){ var rowcount=document.getElementsByName ("parameterTypeId").length; var parameterGrade; var performance; var goal; if(op == "save"){ for (var i=0; i < rowcount; i++) { var param=eval("document.forms [0].parameterGrade"+i); if(param.value != "select"){ return true; } } alert("Please rate atleast one attribute"); return false; }//if ends here
What is unshift method in JavaScript?
What is the difference between innerhtml & innertext?
How we can get the value of an element using javascript?