From 61938554755c4bd57e301c8b662c24a97dfa203d Mon Sep 17 00:00:00 2001 From: Miloslav Macko Date: Mon, 15 Apr 2024 22:13:50 +0200 Subject: [PATCH] 1211 --- cv10/program.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cv10/program.c b/cv10/program.c index cbe2085..3d3c193 100644 --- a/cv10/program.c +++ b/cv10/program.c @@ -42,10 +42,8 @@ int main() { // Výpis prijatých a neprijatých študentov int max_students; - if (scanf("%d\n", &max_students) != 1) { - fprintf(stderr, "Error reading the maximum number of students\n"); - return 1; - } + fgets(line, SIZE, stdin); + sscanf(line, "%d", &max_students); printf("Prijati studenti:\n"); for (int i = 0; i < max_students && i < pocet_mien_v_poli; i++) {