init p1 to p9
This commit is contained in:
commit
8498165fef
9 changed files with 371 additions and 0 deletions
24
p1.c
Normal file
24
p1.c
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
/*
|
||||
* http://projecteuler.net
|
||||
*
|
||||
* Projecteuler - Problem 1
|
||||
* ------------------------
|
||||
* 2008-01-21 Henrik Hautakoski
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define mod(x) ((x % 5) == 0 || (x % 3) == 0)
|
||||
|
||||
int main() {
|
||||
|
||||
int i, r = 0;
|
||||
|
||||
for(i=3; i < 1000; i++)
|
||||
if (mod(i)) r += i;
|
||||
|
||||
printf("%i\n", r);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue