Palindrome
<SCRIPT LANGUAGE = "JavaScript">
/* Input a five digit number and verify if it
is a palindrome. If not: send the user back to
the start to try again */
var num1, int1
do {
num1 = window.prompt("Enter a five digit number", "0");
int1 = parseInt(num1);}
while (int1 > 99999 || int1 < 10000)
if (int1 > 99999 || int1 < 10000)
window.alert("try again");
val1 = parseInt(num1 / Math.pow(10,4));
val2 = parseInt((num1 - (val1 * Math.pow(10,4))) / Math.pow(10,3));
val3 = parseInt((num1 - ((val1 * Math.pow(10,4))) - (val2 * Math.pow(10,3))) / (Math.pow(10,2)));
val4 = parseInt((num1 - ((val1 * Math.pow(10,4))) - (val2 * Math.pow(10,3)) - (val3 * Math.pow(10,2))) / (10));
val5 = parseInt((num1 - ((val1 * Math.pow(10,4))) - (val2 * Math.pow(10,3)) - (val3 * Math.pow(10,2))) - (val4 * 10));
if ( val1 == val5 && val2 == val4)
window.alert("You entered a palindromic number!!!!");
</SCRIPT>
