From 9cee0d1287d2c096c7985b330207aba84e7f23fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1=C5=A1?= Date: Fri, 8 Mar 2024 08:40:36 +0000 Subject: [PATCH] Update 'cv3/program.c' --- cv3/program.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cv3/program.c b/cv3/program.c index a2f5b40..73c5201 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -19,15 +19,14 @@ int main() { double coefficients[MAX_COEFFICIENTS]; int count = 0; - - printf("Enter the value of x: "); + fgets(buffer, BUFFER_SIZE, stdin); if (sscanf(buffer, "%lf", &x) != 1) { printf("Nepodarilo sa nacitat zaklad x\n"); return 0; } - printf("Enter coefficients from highest to lowest degree, finish with an empty line:\n"); + while (fgets(buffer, BUFFER_SIZE, stdin) && buffer[0] != '\n') { if (sscanf(buffer, "%lf", &coef) == 1) { coefficients[count++] = coef; @@ -46,3 +45,4 @@ int main() { return 0; } +