Skip to content

Instantly share code, notes, and snippets.

@AmaanC
Created December 11, 2011 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AmaanC/1460392 to your computer and use it in GitHub Desktop.
Save AmaanC/1460392 to your computer and use it in GitHub Desktop.
Project Euler Solution 6 using C
#include <stdio.h>
main(){
int i, sumOfSquares = 0, squareOfSum, sum = 0;
for(i = 1; i <= 100; i++){
sumOfSquares += i * i;
sum += i;
}
squareOfSum = sum * sum;
printf("%d\n", squareOfSum - sumOfSquares);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment