Ask Question
21 February, 07:37

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) }

+4
Answers (1)
  1. 21 February, 08:44
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers