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.
#include <stdio.h> #include <string.h> #include <ctype.h> void solve() { int sum,i; sum=0; for(i=3; i<1000; i++) { if(i%3==0 || i%5==0) { sum+=i; } } printf("%d\n",sum); } int main() { solve(); return 0; }
Answer:
|
233168 |
相关推荐
3 和 5 的倍数 3 和 5 的倍数 - 1000 以下所有 3 或 5 的倍数之和。
Multiples_of_3_and_5:Project Euler Q1
Problem 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...
欧拉公式求长期率的matlab代码3和5的倍数 您的任务 如果我们列出所有低于10的自然数,它们是3或5的倍数,则得到3、5、6和9。这些倍数的总和为23。 编写代码在sumOfAMultiple函数体在multiples.js文件,以便测试通过...
3和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.
如果我们列出所有低于10的自然数,它们是3或5的倍数,则得到3、5、6和9。这些倍数的总和为23。 找出1000以下3或5的所有倍数的总和。 指示 将您的过程解决方案编码到lib/multiples.rb文件中。 然后,在完成过程解决...
如果我们列出所有低于10的自然数,它们是3或5的倍数,则得到3、5、6和9。这些倍数的总和为23。 找出1000以下3或5的所有倍数的总和。 指示 将您的过程解决方案编码到lib/multiples.rb文件中。 然后,在完成过程解决...
如果我们列出所有低于20的自然数,它们是3或5的倍数,则得到3、5、6、9、10、12、15和18。 这些倍数的总和是78。 在PolyML中加载您的锻炼实施 $ poly --use {exercise}.sml 或者: $ poly > use "{exercise}.sml...
levels of volatility and correlation of price movements tends towards 1 during market crashes. Both of these tendencies leave investors without any downside protection. This means that most of the ...
After doing this analysis, we find that there is a fundamental frequency that has the highest amplitude and possible harmonic frequencies with lesser amplitudes occurring at integer multiples of the ...
如果我们列出所有低于10的自然数,它们是3或5的倍数,则得到3、5、6和9。这些倍数的总和为23。 找出1000以下3或5的所有倍数的总和。 指示 将您的过程解决方案编码到lib/multiples.rb文件中。 然后,在完成过程解决...
如果我们列出所有低于10的自然数,它们是3或5的倍数,则得到3、5、6和9。这些倍数的总和为23。 找出1000以下3或5的所有倍数的总和。 指示 将您的过程解决方案编码到lib/multiples.rb文件中。 然后,在完成过程解决...
如果我们列出所有低于10的自然数,它们是3或5的倍数,则得到3、5、6和9。这些倍数的总和为23。 找出1000以下3或5的所有倍数的总和。 指示 将您的过程解决方案编码到lib/multiples.rb文件中。 然后,在完成过程解决...
如果我们列出所有低于10的自然数,它们是3或5的倍数,则得到3、5、6和9。这些倍数的总和为23。 找出1000以下3或5的所有倍数的总和。 指示 将您的过程解决方案编码到lib/multiples.rb文件中。 然后,在完成过程解决...