Table of Contents
show
Example 35
Write the JavaScript to find area of a triangle whose sides are a, b and c
const prompt = require("prompt-sync")();
let a = parseInt(prompt("Enter side 1 : "));
let b = parseInt(prompt("Enter side 2 : "));
let c = parseInt(prompt("Enter side 3 : "));
let s = (a + b + c) / 2;
let area = Math.sqrt(s * (s - a) * (s - b) * (s - c));
console.log(`Area : ${area}`);
Output
Views: 95