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;
}

Previous page: Problem 5
Next page: Problem 7