diff --git a/archives/1/current b/archives/1/current new file mode 100755 index 0000000..e99f06a Binary files /dev/null and b/archives/1/current differ diff --git a/archives/1/src/main.c b/archives/1/src/main.c new file mode 100644 index 0000000..3e9f57b --- /dev/null +++ b/archives/1/src/main.c @@ -0,0 +1,30 @@ +#include + +/* +If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. + +Find the sum of all the multiples of 3 or 5 below 1000. + +https://projecteuler.net/problem=1 +*/ +int main(int argc,char**argv) { + int counter1=0; + int counter2=0; + int sum=0; + while (counter1<1000||counter2<1000) { + counter1+=3; + if (counter1!=counter2&&counter1<1000) { + sum+=counter1; + printf("Sum is %d (+%d) [3]\n",sum,counter1); + } + if (counter1>counter2) { + counter2+=5; + if (counter1!=counter2&&counter2<1000) { + sum+=counter2; + printf("Sum is %d (+%d) [5]\n",sum,counter2); + } + } + } + printf("%d",sum); + return 0; +} \ No newline at end of file diff --git a/current b/current index deadea3..e99f06a 100755 Binary files a/current and b/current differ diff --git a/src/main.c b/src/main.c index e4b3f6b..aae3546 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,14 @@ #include +/* +Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: + +1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... + +By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. + +https://projecteuler.net/problem=2 +*/ int main(int argc,char**argv) { - printf("Hello World!"); + return 0; } \ No newline at end of file