Flowchart (ISO 5807)
Source code
C
double calcPi(int n) {
double pi = 0;
int sign = 1;
for (int i = 0; i < n; i++) {
pi += sign * 4.0 / (2 * i + 1);
sign = -sign;
}
return pi;
}The editor opens with this code — change it and the chart redraws.
- Language
- C
- Constructs
- alternating series
- Topic
- Loops
- Formats
- Word, Visio, draw.io, PDF, SVG