Write a program to check whether a given number is a
palindrome or not?
Answer Posted / dk
<html>
<body>
<script type="text/javascript">
var n,n1,s,d;
n=prompt('Enter a Number.');
n1=n;
s=0;
while(n!=0)
{
d=n%10;
n=(n-d)/10;
s=(10*s)+d;
}
if(s==n1)
document.write(n1+" is a palindrome");
else
document.write(n1+" is not a palindrome");
</script
</body>
</html>
| Is This Answer Correct ? | 36 Yes | 8 No |
Post New Answer View All Answers
What is primitive data type in javascript?
Why is var better than let?
What is a null variable in javascript?
Write the point of difference between web-garden and a web-farm?
How are javascript and ecma script related?
Is a parabola a function?
How to empty an array in JavaScript?
Explain the difference between javascript and an asp script.
What does question mark mean in react?
How to update a function in javascript?
What is stack in javascript?
How to add behavior to an element using javascript?
Is it safe to use javascript?
How do I use javascript to password-protect my web site?
Explain the working of timers in JavaScript? Also elucidate the drawbacks of using the timer, if any?