Friday, August 18, 2017

Area of the Circle in JavaScript Version 2

Here is another version of my work on Area of the Circle Solver Using JavaScript what does the program will do is to ask the radius of the circle from the user and then our program will compute the it's area. The code is very easy to understand and use.

I hope you will find my work useful and beneficial. If you have some questions about programming, about my work please send mu an email at jakerpomperada@gmail.comand jakerpomperada@yahoo.com. People here in the Philippines can contact me at  my mobile number 09173084360.

Thank you very much and Happy Programming.







Sample Program Output


Program Listing


<!DOCTYPE html> 
<html>
<head> 
<meta charset=utf-8 /> 
<title>Area of the Circle Solver in JavaScript</title> 
<style type="text/css"> 
body {
font-family:arial;
font-size:12;
font-weight:bold;
background-color:lightgreen;
margin: 30px;
}
</style>
</head> 
<body> 
<script>
function solve_area() 
radius = document.getElementById("radius_value").value; 

solve =Math.PI * Number(radius) * Number(radius);
display_result = solve.toFixed(2);
document.getElementById("result").innerHTML = display_result;
</script>
<hr>
<h2>Area of the Circle Solver in JavaScript </h2>
 <hr>
<form> 
<br><br>
Give the Radius of the Circle : <input type="text" id="radius_value" maxlength="5" size="5"><br> 
<br><br>
<input type="button" onClick="solve_area()" Value="Solve" 
title="Click here to find the area of the circle." />  
</form> <br>
<p>The area of the circle is 
<span id = "result">.</span> 
</p> 
</body> 
</html>





No comments:

Post a Comment