play around with indent
This commit is contained in:
parent
877471585c
commit
727938dbcf
2 changed files with 8 additions and 3 deletions
5
Makefile
5
Makefile
|
@ -1,3 +1,8 @@
|
||||||
CFLAGS=-std=c99
|
CFLAGS=-std=c99
|
||||||
|
INDENTOPTS=-kr --no-tabs --braces-on-func-def-line --indent-level2
|
||||||
|
|
||||||
all: approximate-pi
|
all: approximate-pi
|
||||||
|
|
||||||
|
.PHONY: indent
|
||||||
|
indent:
|
||||||
|
indent $(INDENTOPTS) *.c
|
||||||
|
|
|
@ -5,11 +5,11 @@ double approximate_pi(unsigned int steps) {
|
||||||
double approximate_pi = 4.0;
|
double approximate_pi = 4.0;
|
||||||
bool subtract = true;
|
bool subtract = true;
|
||||||
|
|
||||||
for(int i=2; i<=steps; i++) {
|
for (int i = 2; i <= steps; i++) {
|
||||||
if (subtract) {
|
if (subtract) {
|
||||||
approximate_pi -= (4.0/(i*2-1));
|
approximate_pi -= (4.0 / (i * 2 - 1));
|
||||||
} else {
|
} else {
|
||||||
approximate_pi += (4.0/(i*2-1));
|
approximate_pi += (4.0 / (i * 2 - 1));
|
||||||
}
|
}
|
||||||
subtract = !subtract;
|
subtract = !subtract;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue