init p1 to p9
This commit is contained in:
commit
8498165fef
9 changed files with 371 additions and 0 deletions
22
p6.c
Normal file
22
p6.c
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
/*
|
||||
* http://projecteuler.net
|
||||
*
|
||||
* Projecteuler - Problem 6
|
||||
* ------------------------
|
||||
* 2008-03-13 Henrik Hautakoski
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
|
||||
int i, s1 = 1, s2 = 1;
|
||||
|
||||
for(i=2; i <= 100; i++) {
|
||||
s1 += i*i;
|
||||
s2 += i;
|
||||
}
|
||||
|
||||
printf("%i\n", s2*s2 - s1);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue