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-a)*(d-b)*(d-c));
    			System.out.println("%.2f",s); 
    		System.out.println(); 	
    		    }
    	}
    }

/*
Main.java:12: error: no suitable method found for println(String,double)
    			System.out.println("%.2f",s); 
    			          ^
    method PrintStream.println() is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(boolean) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(char) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(int) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(long) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(float) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(double) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(char[]) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(String) is not applicable
      (actual and formal argument lists differ in length)
    method PrintStream.println(Object) is not applicable
      (actual and formal argument lists differ in length)
1 error
*/

Double click to view unformatted code.


Back to problem 24