We got an assignment where we have to calculate the value of pi using the formula pi/4=1-1/3+1/5-1/7+1/9-1/11...(using 100 terms) but it doesn't seem to run the while-loop for some reason. We're students who have no prior experience of writing code and are just starting.
double pi = 1; int count = 0; int n = 3; while (count < 100) { if ((count&1) == 0) { pi = pi - 1 / n; } else { pi = pi + 1 / n; } n = n + 2; count++; } out.print(pi*4); //why is it printing out pi=1?????