Question: Hi here is a c++ program used to guess the value of pi. However, i encountered some troubles. If you put 0, it gives 4,

Hi here is a c++ program used to guess the value of pi. However, i encountered some troubles. If you put 0, it gives 4, which is correct. But as for the other numbers, it just gives back zero. I couldn't find the error and I am pretty sure my logic is correct. Can anyone run this and detect the problem? Btw enter (-1) means to exit the program.
#include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
