Program for finding whether a given number is Palindrome or not using JavaScript.
Learn to Make a program for checking whether the number is palindrome or not using JavaScript .
(2 minutes coding)
Steps to make your own program
1. Open NOTEPAD or NOTEPAD++ in your computer .
2.Copy the code given below .
<!doctype html>
<html>
<head>
<script>
function palindromefunc()
{
var a,num,b,temp=0;
num=Number(document.getElementById("Palindrome_no").value);
b=num;
while(num>0)
{
a=num%10;
num=parseInt(num/10);
temp=temp*10+a;
}
if(temp==b)
{
alert("The number entered is a Palindrome number");
}
else
{
alert("The number entered is not a Palindrome number");
}
}
</script>
<body bgcolor="grey" text="white">
<h1>Palindrome Calculator</h1>
Enter any Number: <input id="Palindrome_no"><br>
<button onclick="palindromefunc()">
Check</button></br></br>
</body>
</html>
3.Now paste it in your Notepad file.
4.Now save your file with .html extension.
5. File will appear like this.






Comments
Post a Comment