プロジェクト・オイラーのアーカイブスからの出典です。
This problem is a programming version of Problem 1 from projecteuler.net.
https://projecteuler.net
プロジェクト・オイラーは、プログラミング (コンピュータ)による一連の計算問題の解決を目的としたウェブサイトです。
Project Euler is a website dedicated to a series of computational problems intended to be solved with computer programs.
プロジェクト・オイラー - Wikipedia
・Project Euler #1: Multiples of 3 and 5
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.
僕が作成して、解答を求めたコードは、以下のとおりです。
My code was written in C.
/* Project Euler in C #1: Multiples of 3 and 5 https://projecteuler.net My code https://neguse-atama.hatenablog.com */ #include<stdio.h> int main(void){ int mul3,mul5,mul15,sum,loop; sum=0; for(loop=1;loop<1000;loop++){ if(loop%3==0){ mul3=loop; sum+=mul3; } if(loop%5==0){ mul5=loop; sum+=mul5; } if(loop%15==0){ mul15=loop; sum-=mul15; } } printf("%d\n",sum); return 0; }
今週は、Xcodeで簡単なアプリを試作してみました。
はじめてのアプリ開発でしたが、実際にシミュレータ上で動作しているところを確認できたので安心しました。
基本的には、下記のような流れです。
1.プロジェクトの新規作成
2.デザイン
3.デザインとプログラムを繋げる
4.プログラムの実装
5.実行
だから、OSやデバイスが違っても、似たようなアプリが溢れているのかもしれません。
これから夏休みとかを利用して、何かプロダクトを開発できたら、ホームページも制作してみようと思いました。