2021-08-18 21:00:43 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>Document</title>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
/*
|
|
|
|
Faça um algoritmo para calcular a area de um triangulo
|
|
|
|
*/
|
|
|
|
function triangleArea(base, height) {
|
|
|
|
// implementar logica aqui
|
2022-10-23 11:12:44 +00:00
|
|
|
let area = (base * height)/2;
|
|
|
|
return area;
|
2021-08-18 21:00:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Resultados esperados
|
|
|
|
console.log(triangleArea(3, 5), 7.5) // 7.5
|
|
|
|
console.log(triangleArea(5, 5), 12.5) // 12.5
|
|
|
|
console.log(triangleArea(2, 5), 5) // 5
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|