Friday 1 April 2016

Chapter 1 Exercise 7, Introduction to Java Programming, Tenth Edition Y. Daniel LiangY.

(Approximatep)  pi can be computed using the following formula:
4.0 * (1 - (1.0/3) + (1.0/5) - (1.0/7) + (1.0/9) - (1.0/11))

public class Exercise_07 {

    public static void main(String[] args) {

        double pi = 4.0 * (1 - (1.0/3) + (1.0/5) - (1.0/7) + (1.0/9) - (1.0/11));
        System.out.println(pi); //
    }
}

No comments :

Post a Comment