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;
- Flowchart of program to show power of a number.
- Program to show power of a number.
- Program to show power of a number with form values by user.
Flowchart of program to show power of a number.
Program to show power of a number.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <!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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <!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> |