Q:

Write a Java program to compute a specified formula.

0

Write a Java program to compute a specified formula.

Specified Formula :
4.0 * (1 - (1.0/3) + (1.0/5) - (1.0/7) + (1.0/9) - (1.0/11))
Expected Output
2.9760461760461765

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

public class Exercise10 {
 
    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); //
    }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now