Write a Program to Display whether number is palindrome or not
Name of Program - To display the number whether it is palindrome or not.
Code Input -
<html>
<head>
<script>
function Palindrome()
{
var rem, temp, final = 0;
var number = Number(document.getElementById("N").value);
temp = number;
while(number>0)
{
rem = number%10;
number = parseInt(number/10);
final = final*10+rem;
}
if(final==temp)
{
window.alert("The inputed number is Palindrome");
}
else
{
window.alert("The inputted number is not palindrome");
}
}
</script>
</head>
<body>
<br>
<h1>Whether a number is Palindrome or not</h1>
Enter The Number :<input type="text" name="n" id = "N"/>
<hr color="cyan">
<br>
<center><button onClick="Palindrome()">CHECK</button>
</body>
</html>
Post a Comment