JavaScript program to show power of a number with flowchart and form values by user

JavaScript program to show power of a number with flowchart and form values by user

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

  1. Flowchart of program to show power of a number.
  2. Program to show power of a number.
  3. Program to show power of a number with form values by user.

Flowchart of program to show power of a number.

JavaScript program to show power of a number flowchart form values by user.
Figure: Flowchart of program to show power of a number.

Program to show power of a number.

<!DOCTYPE html>
<html>
<head><title>Power</title>
<script>
function power()
{
var e = document.getElementById("exp").value;
var n = document.getElementById("num").value;
var pow = Math.pow(n,e);
document.write(pow);

}
</script>
</head>
<body>
<p style="font-size:20px; ">Num 
<input type="text" id="num" value="4" />power
<input type="text" id="exp" value="3" /> <button type="button" onclick="power()">power</button>
</body>
</html>

Program to show power of a number with form values by user.

<!DOCTYPE html>
<html>
<head><title>Power</title>
<script>
function power()
{
var e = document.getElementById("exp").value;
var n = document.getElementById("num").value;
var pow = Math.pow(n,e);
document.write(pow);

}
</script>
</head>
<body>
<p style="font-size:20px; ">Enter Base
<input type="text" id="num" value="" />Enter Exponent
<input type="text" id="exp" value="" /> <button type="button" onclick="power()">power</button>
</body>
</html>

 
List of All Programs of Javascript : Click Here 
.

Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.