A sample program in JavaScript that I wrote that will ask the user to enter a number and then our program will reverse the arrangement of numbers given by the user.
If you have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360.
Sample Program Output
Program Listing
<html>
<head>
<title>Reverse a Number </title>
</head>
<style>
h3 {
font-family:arial;
};
</style>
<body>
<script>
var reverse_number =0;
var num_value = parseInt(prompt("Enter number: "));
document.write("<br>");
document.write("<h3> Reverse a Number</h3>");
document.write("<font face='arial' size='3'>");
document.write("The Original Number is " + num_value + " .</font> <br>");
while( num_value != 0 )
{
reverse_number = parseInt(reverse_number * 10);
reverse_number = parseInt(reverse_number + (num_value%10));
num_value = parseInt(num_value/10);
}
document.write("<font face='arial' size='3'>");
document.write("The Reverse Number is " + reverse_number + " .</font> <br>");
document.write("<h3> End of Program </h3>");
</script>
</body>
</html>