solve problem 6
This commit is contained in:
parent
30936fa435
commit
7d323062a4
12
Program.cs
12
Program.cs
@ -110,8 +110,18 @@ namespace Euler {
|
||||
}
|
||||
}
|
||||
|
||||
static long Problem6() {
|
||||
long sum = 0;
|
||||
long sumSq = 0;
|
||||
for (long i = 1; i <= 100; i++) {
|
||||
sum += i;
|
||||
sumSq += i * i;
|
||||
}
|
||||
return sum * sum - sumSq;
|
||||
}
|
||||
|
||||
static void Main(string[] args) {
|
||||
WriteLine(Problem5());
|
||||
WriteLine(Problem6());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user