View Code of Problem 24

import java.io.IOException;
import java.util.Scanner;

public class Test {
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		int a;
		int b;
		int c;
		double l;
		double area;
		a = scan.nextInt();
		b = scan.nextInt();
		c = scan.nextInt();
        scan.close();
        l = (a+b+c)/2;
        area = Math.sqrt(l*(l-a)*(l-b)*(l-c));
        System.out.println(area);
       }

}

/*
Main.java:5: error: class Test is public, should be declared in a file named Test.java
public class Test {
       ^
1 error
*/

Double click to view unformatted code.


Back to problem 24