View Code of Problem 24

import java.util.Scanner;
public class Main{
	public static void main(String args[]){
		int a,b,c;
		double ans,p;
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			a=scan.nextInt();
			b=scan.nextInt();
			c=scan.nextInt();
		p=(a+b+c)/2.0;
			System.out.println(String.format("%.2f",Math.sqrt((p-a)*(p-b)*(p-c)*p)));
	}
	}

}

Double click to view unformatted code.


Back to problem 24