Showing posts with label Area of the Square in JavaScript. Show all posts
Showing posts with label Area of the Square in JavaScript. Show all posts

Friday, October 23, 2015

Area of the Square Using JavaScript

A simple program that I wrote in JavaScript will compute the area of the square using JavaScript. The program is very simple to understand and ideal for beginners in JavaScript programming.

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>Area of Square</title>
</head>
<style>
h3 {
   font-family:arial;
   };
</style>
<body>
  <script>
    var side = parseFloat(prompt("Enter Side of the Square : "));
 
    var solving_area = (side * side);
 
document.write("<br>");
document.write("<h3> Area of Square</h3>");
document.write("<font face='arial' size='3'>")
    document.write(" The Sides of the Square is " + side + ".</font><br>");
document.write("<font face='arial' size='3'>")
    document.write(" The Area of the Square is " + solving_area + ".</font><br>");
document.write("<h3> End of Program </h3>");
</script>
</body>
</html>