diff --git a/cv10/program.c b/cv10/program.c index 6e7c5a1..d6ec6ee 100644 --- a/cv10/program.c +++ b/cv10/program.c @@ -24,8 +24,8 @@ int main() { } i = 0; - while (fgets(buffer, sizeof(buffer), stdin)) { - if (buffer[0] == '\n' || i >= count) { // End of input or reached maximum count + while (i < count && fgets(buffer, sizeof(buffer), stdin)) { + if (buffer[0] == '\n') { // End of input line break; } int len = strlen(buffer);