diff --git a/Makefile b/Makefile index 03e1c60..1e5aae3 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,8 @@ CFLAGS=-std=c99 +INDENTOPTS=-kr --no-tabs --braces-on-func-def-line --indent-level2 all: approximate-pi + +.PHONY: indent +indent: + indent $(INDENTOPTS) *.c diff --git a/approximate-pi.c b/approximate-pi.c index 7c37b7b..feeabd2 100644 --- a/approximate-pi.c +++ b/approximate-pi.c @@ -5,11 +5,11 @@ double approximate_pi(unsigned int steps) { double approximate_pi = 4.0; bool subtract = true; - for(int i=2; i<=steps; i++) { + for (int i = 2; i <= steps; i++) { if (subtract) { - approximate_pi -= (4.0/(i*2-1)); + approximate_pi -= (4.0 / (i * 2 - 1)); } else { - approximate_pi += (4.0/(i*2-1)); + approximate_pi += (4.0 / (i * 2 - 1)); } subtract = !subtract; }