projecteuler_problem1
problem1
地址:https://projecteuler.net/problem=1。
問題:找到1000內3或5的倍數的和。
源碼:git@code.aliyun.com:qianlizhixing12/ProjectEuler.git。
#include <stdio.h>
#define MAXNUM 1000
int main(int argc, char **argv){
int iResult = 0;
int i;
for (i = 1; i < MAXNUM; ++i){
if ((i % 3 == 0) || (i % 5 == 0)) iResult += i;
}
printf("Problem1 Answer: %d\n", iResult);
return 0;
}
最後更新:2017-10-02 21:07:32