View Code of Problem 24

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while(scanner.hasNext()) {
			int a = scanner.nextInt();
			int b = scanner.nextInt();
			int c = scanner.nextInt();
			double d,s;
			d = (a + b + c) / 2.0;
			s = Math.sqrt(d * (d -a) * (d - b) * (d - c));
			System.out.printf("%.2f\n",s);
		}
	}
}

Double click to view unformatted code.


Back to problem 24