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