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
How do I open javascript console?
What is the potential disadvantage of using a sticky session?
Why is javascript so hard?
What Does JavaScript Void(0) Mean?
How to write hello world on the web page?
Explain a story about javascript performance problems?
What is an onclick?
How to create function in JavaScript?
What is use of settimeout function in javascript?
Are all javascript variables global?
What is stack in javascript?
What javascript means?
What is the difference between innerhtml and append() in javascript?
What is difference between local variable and global?
Where are cookies actually stored on the hard disk?