Question: Given a triangle with sides 13, 14 and 15, what is it's area?
Answer: 84
Solved using the script below:
console.log("********************************");
function Herons(a,b,c){
var perimeter=a+b+c;
var s = perimeter/2;
return Math.sqrt(s*(s-a)*(s-b)*(s-c));
}
console.log(Herons(13,14,15));
No comments:
Post a Comment