aboutsummaryrefslogtreecommitdiffstats
path: root/euler1.c
diff options
context:
space:
mode:
authormjfernez <mjfernez@gmail.com>2018-12-02 19:12:42 -0500
committermjfernez <mjfernez@gmail.com>2018-12-02 19:12:42 -0500
commitd62ba829dc3a54edc46b7deb581dd244713393f5 (patch)
tree637d985d70fff70c4dedc14a45c559747ea18b84 /euler1.c
parentc15221f10ed2ea4a55b474a57b6ee39f6b24ac85 (diff)
downloadProject_Euler_Solutions-d62ba829dc3a54edc46b7deb581dd244713393f5.tar.gz
add code
Diffstat (limited to 'euler1.c')
-rw-r--r--euler1.c13
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);
+}