Date created: Sunday, July 10, 2011 7:12:02 PM. Last modified: Thursday, December 13, 2012 11:41:20 AM
Problem 6
// Project Euler - Problem 6
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char *argv[]) {
int count = 0;
int squares = 0;
int total = 0;
while (count<=atoi(argv[1])) {
squares += count * count;
total += count;
count++;
}
printf("Difference: %d\n", (total*total)-squares);
return EXIT_SUCCESS;
}