aboutsummaryrefslogtreecommitdiffstats
path: root/01-Multiples-of-3-and-5/euler1.c
diff options
context:
space:
mode:
authormjfernez <mjfernez@gmail.com>2020-02-09 15:16:26 -0500
committermjfernez <mjfernez@gmail.com>2020-02-09 15:16:26 -0500
commit93ea7fe5957b62f18e8fbd17a21696bd7de6332d (patch)
treed90aed60d687bcf195f1150777f37cbe8a149814 /01-Multiples-of-3-and-5/euler1.c
parent125ec5bc3d8bfc224b7d32bcfbbc37b9fb5d441f (diff)
downloadProject_Euler_Solutions-93ea7fe5957b62f18e8fbd17a21696bd7de6332d.tar.gz
Organized everything, update README
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);
+}