aboutsummaryrefslogtreecommitdiffstats
path: root/01-Multiples-of-3-and-5/euler1.c
diff options
context:
space:
mode:
Diffstat (limited to '01-Multiples-of-3-and-5/euler1.c')
-rw-r--r--01-Multiples-of-3-and-5/euler1.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/01-Multiples-of-3-and-5/euler1.c b/01-Multiples-of-3-and-5/euler1.c
new file mode 100644
index 0000000..d89956e
--- /dev/null
+++ b/01-Multiples-of-3-and-5/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);
+}