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
Why javascript is not secure?
What Is The Disadvantages Using InnerHTML In JavaScript?
How can an HTMLCollection be traversed?
How are object properties assigned?
Is JavaScript a true OOP language?
What is js injection?
Which built-in method adds one or more elements to the end of an array and returns the new length of the array?
What is difference between java and javascript?
How you will add function as a property in a javascript object? Give an example.
Explain hoisting in javascript?
How do you name a variable in javascript?
Can array in javascript be extended?
Explain the typeof operator?
What is the difference between client side javascript and server side javascript.
How to have the status line update when the mouse goes over a link (the support of the status line is sporadic)?