final int max=1000; double item=0; double sum=0; int flag=-1; int n=0; for(n=0;n<=max;n++) { flag*=-1; item=flag*1.0/(2*n+1); sum += item; } System.out.println(4*sum);
final int max=1000; double item=0; double sum=0; int flag=-1; int n=0; for(n=0;n<=max;n++) { flag*=-1; item=flag*1.0/(2*n+1); sum += item; } System.out.println(4*sum);
转载于:https://www.cnblogs.com/JAYPARK/p/10503051.html