solve problem 6

This commit is contained in:
Colin McMillen 2020-11-17 14:51:49 -05:00
parent 30936fa435
commit 7d323062a4

View File

@ -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) { static void Main(string[] args) {
WriteLine(Problem5()); WriteLine(Problem6());
} }
} }
} }