Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

javascript program to show the reverse of numbers

javascript program to show the reverse of numbers

In this tutorial, we will try to learn the followings;

  1. Flowchart of the javascript program to show the reverse of numbers.
  2. Javascript program to show the reverse of numbers.
  3. javascript program to show the reverse of numbers with form values entered by the user.

Flowchart of the javascript program to show the reverse of numbers.

javascript program to show the reverse of numebrs

Figure: javascript program to show the reverse of numbers.

Javascript program to show the reverse of numbers.

<html>
<head>
<script>
function reverse()
{
var x,y,z,temp=0;

y=257;

z=y;
while(y>0)
{
x=y%10;
y=parseInt(y/10);
temp=temp*10+x;
}
alert(temp);
}
</script>
</head>
<body>
<h1>Reverse</h1>
<p>Give value is=257</p>
<button onclick="reverse()">Check</button></br></br>
</body>
</html>

javascript program to show the reverse of numbers with form values entered by the user.

<html>
<head>
<script>
function reverse()
{
var x,y,z,temp=0;

y=Number(document.getElementById("demo").value);

z=y;
while(y>0)
{
x=y%10;
y=parseInt(y/10);
temp=temp*10+x;
}
alert(temp);
}
</script>
</head>
<body>
Enter a Number: <input id="demo">
<button onclick="reverse()">Check</button></br></br>
</body>
</html>

Topic Covered

javascript program to show the reverse of numbers. 
  List of All Programs of Javascript : Click Here 
.

Prof. Fzal Rehman Shamil
Instructor, Researcher, Blogger, SEO Expert, Poet and Publisher of International Journal Of Software, Technology & Science ISSN : 2616 - 5325