diff --git a/test.c b/test.c index 6b61525..7fe27b8 100644 --- a/test.c +++ b/test.c @@ -5,11 +5,7 @@ int sum(int n) { - int sum = 0; - for(int i = 1; i <= n; i++) { - sum += i; - } - return sum; + return (n * (n - 1)) / 2; } void usage(const char* app_name, const char* err_string)