Ask Question
18 December, 14:11

Java Program for lengths of the sides of a triangle to compute the area using the given equation LaTeX: Area/:=/:/sqrt{s/left (s-a/right) / left (s-b/right) / left (s-c/right) }

+3
Answers (1)
  1. 18 December, 17:57
    0
    import java. util. Scanner;

    public class Area

    {

    public static void main (String[] args) {

    double a, b, c, s, area;

    Scanner input = new Scanner (System. in);

    System. out. print ("Enter three sides of the triangle: ");

    a = input. nextDouble ();

    b = input. nextDouble ();

    c = input. nextDouble ();

    s = (a + b + c) / 2;

    area = Math. sqrt (s * (s-a) * (s-b) * (s-c));

    System. out. print ("The area of triangle = " + area);

    }

    }

    Explanation:

    Define variables for the sides, s, and area.

    Ask the user for the side values using Scanner object.

    Use the given formula to calculate s.

    After calculating s, use the formula to calculate area.

    Print the value of area.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Java Program for lengths of the sides of a triangle to compute the area using the given equation LaTeX: Area/:=/:/sqrt{s/left (s-a/right) / ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers