View Code of Problem 24

import java.util.Scanner;
public class Main {
	public static void main(String[] args) {	
		int[] a = new int[3];
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()) {
			a[0] = scan.nextInt();
			a[1] = scan.nextInt();
			a[2] = scan.nextInt();
		
		
		float p =(float)(a[0] +a[1] +a[2])/2;
		float sum = p*(p-a[0])*(p-a[1])*(p-a[2]);
		float n=(float) Math.sqrt(sum);
		System.out.println(String.format("%.2f", n));
		
		}
		scan.close();
		}
}

Double click to view unformatted code.


Back to problem 24