diff --git a/cv3/program.c b/cv3/program.c index d741671..685a49f 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -1,5 +1,4 @@ #include -#include #define SIZE 100 @@ -11,19 +10,7 @@ int main() { int length = 0; double result = 0.0; - while (count < SIZE) - { - if (coefs[count] == '\n') - { - return; - } - - - else if (scanf("%d", &input) != 1) - { - printf("Nepodarilo sa nacitat polynom na %d mieste.", count); - break; - } + while (count < SIZE && scanf("%lf", &input) == 1) { coefs[count] = input; count++; } @@ -32,14 +19,11 @@ int main() { length = count; - for (int i = 1; i < length; i ++) - { - result = result * x + coefs[i]; + for (int i = 1; i < length; i ++){ + result = result * x + coefs[i]; } printf("Vysledok je: %.2lf\n", result); return 0; -} - - +} \ No newline at end of file