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
Is javascript case sensitive language?
How to define name function in javascript?
What is 'use strict'?
What causes memory leaks?
What is the difference between typeof and instanceof operators in Javascript?
What is a closure javascript?
Do you have to declare variables in javascript?
What is a function callback?
What javascript means?
What is the use of isNaN function?
Can you put javascript in html?
What is the difference between local storage & session storage?
What is the difference between attributes and property?
What is the === in javascript?
What do I need to code javascript?