You are on page 1of 1

import java.util.

Scanner;
public class TriangleProblem_Estanoco {

public static void main(String[] args) {

Scanner kbd = new Scanner(System.in);


System.out.println("Enter the three sides of a triangle: ");
System.out.print("Enter the side a: ");
double a = kbd.nextDouble();
System.out.print("Enter the side b: ");
double b = kbd.nextDouble();
System.out.print("Enter the side c: ");
double c = kbd.nextDouble();
double S = (a+b+c)/2.0;
double A = Math.sqrt(S*(S-a)*(S-b)*(S-c));

if((a+b)> c &&(a+c) > b &&(b+c) > a)

System.out.println("The area of triangle is: " +A);


double r_insc = (A/S);
double x = Math.PI*Math.pow(r_insc, 2);
System.out.println("The area of largest inscribed circle is: " + x );
double r_circ = (a*b*c)/(4*A);
double y = Math.PI*Math.pow(r_circ, 2);
System.out.println("The area if the smallest circumscribed circle: " + y);
}
}

You might also like