From b2b446cdf2fe312d0066847d3f7d94d64e2d1ea0 Mon Sep 17 00:00:00 2001 From: ak643du Date: Tue, 5 Mar 2024 10:48:49 +0100 Subject: [PATCH] Initialization --- cv3/program.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cv3/program.c b/cv3/program.c index 3b7db13..91964df 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -11,15 +11,17 @@ int main() { double result = 0.0; while (count < SIZE) { - if (scanf("%lf", &input) != 1) { + + if (scanf("%lf", &input) != 1 && (scanf("%c", &input) != 1 || input != 'x')) { printf("Nepodarilo sa nacitat polynom na %d mieste.\n", count + 1); break; } - if (input == 'x') { break; } - } + coefs[count] = input; + count++; + } coefs[count] = input;