0
Omg this Question can somone solve it ! Help pls
Q)- Calculate the value of π from the infinte series π = 4 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11 + ....... print the approximated value of π by computing the first 200,000 terms of this series. How many terma do you have to use before you first get a value that begins with 3.14159 and what is the value ?
10 Antworten
+ 1
thanks but not working on java eclipse
😢😢😢😢
+ 1
thanks alote 🌷🌷🌷🌷
0
Why can't you write a program to find out? It is a simple program.
set result to zero
for all positive odd numbers
if the current number modulus 4 is 1
4 divided by the number is added to the result
else
4 divided by the number is subtracted from the result
if the truncation of the result times 100000 is equal to 314159
output the current number yields our match
exit the loop
0
how pls can you tell me i was try too much
0
Sure, code something and I'll help you get it running.
0
thanks alote i am waiting you😊
0
First, make a sum variable and set it to 0.
Next make a variable for the denominator and set it equal to 1. And a four variable and set it to -4.
Then start a for loop that iterates the number of times you want it to.
In each loop you will add this:
sum += four / denominator;
Then you will increment denominator by 2 and flip tour's sign:
denominator += 2;
four *= -1;
Then you can print sum every loop too, if you want.
0
can somone write it in program pls i try alote all time say error 😢
0
Here is one in c++, but it should be very similar in java. (double) before a variable just means I'm casting the integers to a double, so use that in java, if needed. I am not a java person at all:
https://code.sololearn.com/climfmpJ9z20/?ref=app
0
https://code.sololearn.com/chIQjnByoC4w/?ref=app