From a46eae69fc2bc5d87fcb74a4c4feb023557f83f8 Mon Sep 17 00:00:00 2001 From: juan Date: Tue, 12 Oct 2021 17:04:08 +0800 Subject: [PATCH] fix obvious error --- pset3/3-sum.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pset3/3-sum.c b/pset3/3-sum.c index 9e545a3..8509a18 100644 --- a/pset3/3-sum.c +++ b/pset3/3-sum.c @@ -8,12 +8,12 @@ int main(void) { // if n is smaller than 3 if (n < 3) { - printf("0"); + printf("0\n"); return 0; } // Iterate through all - for (long long i = 3; i < n; i++) { + for (long long i = 3; i <= n; i++) { sum += i * (i - 1) * (i - 2); }