View Code of Problem 24

import java.math.*;
import java.util.Scanner;
 
public class Main{
  public static void main(String args[]){
    Scanner s = new Scanner(System.in);
    System.out.println("number:");
    int a = s.nextInt();
    Scanner t = new Scanner(System.in);
    int b = t.nextInt();
    Scanner w = new Scanner(System.in);
    int c = w.nextInt();
    double p = (a+b+c)/2;
    double S= Math.sqrt(p*(p-a)*(p-b)*(p-c));
    System.out.println(String.format("%.2f", S));
  }
}

Double click to view unformatted code.


Back to problem 24