<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<!DOCTYPE html>
<html>
<head>
<title>Biletul nr 9</title>
</head>
<body>
<center>
<h1>Verifică dacă numărul este palindrom</h1>
<h2 id='result'></h2>
Introduceți numărul :<input type="text" name="n" id = "N"/>
<hr color="navy">
<br>
<button onClick="palindrom()">Verifică</button>
</center>
</body>
<script>
function palindrom()
{
var rem, temp, final = 0;
var number = Number(document.getElementById("N").value);
temp = number;
if(number == 0 || number == null)
{
alert("Nu ați introdus nici un număr");
}
while(number>0)
{
rem = number%10;
number = parseInt(number/10);
final = final*10+rem;
}
if(final==temp)
{
document.getElementById("result").textContent="Numărul " + final + " este palindrom";
}
else
{
document.getElementById("result").textContent="Numărul " + final + " nu este palindrom";
}
}
</script>
</html>