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 ?

27th Nov 2017, 4:17 PM
Tudes Mubarak
Tudes Mubarak - avatar
10 Answers
+ 1
thanks but not working on java eclipse 😢😢😢😢
27th Nov 2017, 5:53 PM
Tudes Mubarak
Tudes Mubarak - avatar
+ 1
thanks alote 🌷🌷🌷🌷
27th Nov 2017, 7:38 PM
Tudes Mubarak
Tudes Mubarak - avatar
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
27th Nov 2017, 4:40 PM
John Wells
John Wells - avatar
0
how pls can you tell me i was try too much
27th Nov 2017, 5:01 PM
Tudes Mubarak
Tudes Mubarak - avatar
0
Sure, code something and I'll help you get it running.
27th Nov 2017, 5:04 PM
John Wells
John Wells - avatar
0
thanks alote i am waiting you😊
27th Nov 2017, 5:05 PM
Tudes Mubarak
Tudes Mubarak - avatar
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.
27th Nov 2017, 5:15 PM
Zeke Williams
Zeke Williams - avatar
0
can somone write it in program pls i try alote all time say error 😢
27th Nov 2017, 5:23 PM
Tudes Mubarak
Tudes Mubarak - avatar
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
27th Nov 2017, 5:25 PM
Zeke Williams
Zeke Williams - avatar
0
https://code.sololearn.com/chIQjnByoC4w/?ref=app
27th Nov 2017, 7:12 PM
Zeke Williams
Zeke Williams - avatar