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 +}