Write a JavaScript program to find the area of a triangle
vnesi 3 perimetri:
vrednost 1:
vrednost 2:
vrednost 3:
Area of Triangle is:
CODE:
function triangleArea(a,b,c) {
var perimetar = (a+b+c)/2;
var area = Math.sqrt(perimetar*((perimetar-a)*(perimetar-b)*(perimetar-c)));
return area;
}
function evSmetaj(){
var a1 = document.querySelector("input[name=a]").value;
var b1 = document.querySelector("input[name=b]").value;
var c1 = document.querySelector("input[name=c]").value;
var ekran = document.querySelector("#ekran");
var oRez = triangleArea(1*a1,1*b1,1*c1);
oRez = oRez.toFixed(2);
ekran.innerHTML = oRez;
}