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
How long does it take to learn javascript?
What is 'use strict'?
Explain event bubbling and event capturing in javascript?
What is a callback url?
What does break and continue statements do in javascript?
Give an example of closure?
How do you declare in javascript?
How can javascript codes be hidden from old browsers that don't support javascript?
Which software is used for javascript?
What is lambda in programming?
How do I unblock javascript in chrome?
How are tag positions used in javascript?
What is the scope variable in javascript?
How to get complete current page url with javascript?
Write a Program using Servlet and JDBC for developing online application for displaying the details of Cars owned by the residents in XYZ society. Make necessary assumptions and create appropriate databases