From 5b6d09c10429f0ffa300f003d5cd8064bc46ae63 Mon Sep 17 00:00:00 2001 From: Denys Sanchuk Date: Tue, 25 Feb 2025 14:06:18 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20du2/program.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du2/program.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/du2/program.c b/du2/program.c index 258a4e3..d069e2d 100644 --- a/du2/program.c +++ b/du2/program.c @@ -13,7 +13,12 @@ int main() { return 1; } - while (count < MAX_SIZE && scanf("%lf", &coefficient) == 1) { + while (count < MAX_SIZE) { + if (scanf("%lf", &coefficient) != 1) { + if (feof(stdin)) break; // Конец файла - завершаем чтение + printf("Nepodarilo sa nacitat polynom na %d mieste.\n", count + 1); + return 1; + } coefficients[count++] = coefficient; } @@ -30,4 +35,4 @@ int main() { printf("Vysledok je: %.2lf\n", result); return 0; -} \ No newline at end of file +}