diff options
Diffstat (limited to 'euler1.c')
-rw-r--r-- | euler1.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/euler1.c b/euler1.c new file mode 100644 index 0000000..d89956e --- /dev/null +++ b/euler1.c @@ -0,0 +1,13 @@ +#include <stdio.h> +#include <stdlib.h> +//Problem 1: multiples of 3 and 5 +int main(){ + int max = 1000; + int i; double sum; + + for (i=0;i<max; i++) + if(i%3 == 0 || i%5==0) + sum+= (double) i; + + printf("%f\n", sum); +} |