Created
January 28, 2013 17:47
-
-
Save esn89/4657542 to your computer and use it in GitHub Desktop.
This file contains 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 <iostream> | |
using namespace std; | |
int main() { | |
int temp = 0; | |
int temp2 = 0; | |
//temp is the sum of the squares | |
for(int i=1; i<=100; i++) { | |
temp += i*i; | |
} | |
//temp2 accumulates the numbers then squares them later | |
for(int j=1; j<=100; j++) { | |
temp2 += j; | |
} | |
int answer = (temp2 * temp2) - temp; | |
cout << answer << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment