Answer:
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);
}
}
Step-by-step 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.