Created
February 10, 2026 15:49
-
-
Save dgodfrey206/688ec11b01df55540180772bfb2d53e0 to your computer and use it in GitHub Desktop.
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| #include <cassert> | |
| using namespace std; | |
| int main() { | |
| int n = 100; | |
| int result = (n * (n + 1) * (3 * n * (n + 1) - 2 * (2 * n + 1)))/12; | |
| cout << result; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment