Area of Triangle
Hi friends lets see how to do Area of Triangle using JavaScript
Area of a triangle is Half its Height and width , this code is just for saying how mathematical Formulas can be practiced in JavaScript , Not for only calculating the Area of Triangle but for Circle Sphere using related Formulas .
Now lets begin
Program :
Area of a triangle is Half its Height and width , this code is just for saying how mathematical Formulas can be practiced in JavaScript , Not for only calculating the Area of Triangle but for Circle Sphere using related Formulas .
Now lets begin
Program :
<html>
<body>
<title> Key~ttu </title>
<h2>AREA OF TRIANGLE</h2>
<button type="button" onclick="height()">ENTER THE HEIGHT</button><br></br>
<button type="button" onclick="width()">ENTER THE WIDTH</button><br></br>
<button type="button" onclick="area()">AREA</button><br></br>
<script>
var b,h;
function height()
{
h=prompt("Enter the height");
}
function width()
{
b=prompt("Enter the width");
}
function area()
{
document.write((b*h)/2);
}
</script>
</body>
</html>
<body>
<title> Key~ttu </title>
<h2>AREA OF TRIANGLE</h2>
<button type="button" onclick="height()">ENTER THE HEIGHT</button><br></br>
<button type="button" onclick="width()">ENTER THE WIDTH</button><br></br>
<button type="button" onclick="area()">AREA</button><br></br>
<script>
var b,h;
function height()
{
h=prompt("Enter the height");
}
function width()
{
b=prompt("Enter the width");
}
function area()
{
document.write((b*h)/2);
}
</script>
</body>
</html>
Here you go Friends , Ask me doubts in the Comment Session
you can execute this code at this link :
Have a Nice Day
Comments
Post a Comment