This Program will calculate the value of π.This Program will calculate

the approximated value of π after computing 200,000 terms of the following series.

**Code:**

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
#include<iostream> using namespace std; int main() { int c=0; double pi=0; float a=200000; for(a=1;a<=200000;a=a+2) { if(c==0) { pi=pi+4/a; c++; } else { pi=pi-4/a; c--; } } cout<<"PI's Value = "<<pi<<endl; return 0; } |

**Output:**

## Add comment