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;