Showing posts with label area of the rectangle in javascript. Show all posts
Showing posts with label area of the rectangle in javascript. Show all posts

Friday, October 23, 2015

Area of a Rectangle in JavaScript

A program in JavaScript that will ask input value from the user and then compute the area of the rectangle.

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 Rectangle</title>
</head>
<style>
h3 {
   font-family:arial;
   };
</style>
<body>
  <script>
    
var length = parseInt(prompt("Enter length of Rectangle : "));
var width = parseInt(prompt("Enter width of Rectangle : "));
   
    var solving_area = (length * width);
 
document.write("<br>");
document.write("<h3> Area of Rectangle</h3>");
document.write("<font face='arial' size='3'>")
    document.write(" The Length of Rectangle is " + length + ".</font><br>");
document.write("<font face='arial' size='3'>")
    document.write(" The Width of Rectangle is " + width + ".</font><br><br>");
    document.write("<font face='arial' size='3'>")
    document.write(" The Area of Rectangle is " + solving_area + ".</font>");
document.write("<h3> End of Program </h3>");
</script>
</body>

</html>