View Code of Problem 24

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

Double click to view unformatted code.


Back to problem 24