class Ex1_2_8 {
  public static void main(String[] args) {
    double current = -1;
    int N = 100000;
    float h = (float) (1 - (-1)) / N;
    current += h / 2;

    double integral = 0;
    while (current <= 1.0) {
      integral += h * Math.sqrt(1 - current * current);
      current += h;
    }
    double pi = integral * 2;

    System.out.println("PI = " + pi);
  }
}