write event driven JavaScript program to accept height and base from the user and find area of triangle
Answers
Answered by
2
Coding:
area = (base * height) / 2
const baseValue = prompt('Enter the base of a triangle: ');
const heightValue = prompt('Enter the height of a triangle: ');
// calculate the area
const areaValue = (baseValue * heightValue) / 2;
console.log(
`The area of the triangle is ${areaValue}`
);
Output:
[Enter the base of a triangle: 4]
[Enter the height of a triangle: 6]
[The area of the triangle is 12]
Similar questions
Hindi,
1 month ago
Math,
1 month ago
Geography,
1 month ago
Environmental Sciences,
10 months ago
Social Sciences,
10 months ago