blob: 5a17cea9415b840d319e5c06751f525f82b8ec6c (
plain) (
tree)
|
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main (int argc, char ** argv) {
if (argc != 1+1) {
fprintf(stderr, "uporaba: %s <koliko>\nprimer: %s 100\n", argv[0], argv[0]);
return 1;
}
unsigned long int i = 1;
unsigned long int m = atoi(argv[1]);
unsigned long long int s = 0;
unsigned long long int z = 0;
for (i = 1; i <= m; i++) {
s = s + pow(i, 2);
z = z + i;
}
z = pow(z, 2);
fprintf(stdout, "konec. %lld - %lld = %lld\n", z, s, z-s);
return 0;
}
|