From 4d2fb827b0ab98019133a7849bcda2ce73317468 Mon Sep 17 00:00:00 2001 From: ak643du Date: Mon, 4 Mar 2024 19:52:12 +0100 Subject: [PATCH] Initialization --- cv3/program.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/cv3/program.c b/cv3/program.c index e46d9e4..b48d5b4 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -11,7 +11,12 @@ int main() { int length = 0; double result = 0.0; - while (count < SIZE && scanf("%lf", &input) == 1) { + while (count < SIZE) { + if (scanf("%d", &input) != 1) { + printf("Nepodarilo sa nacitat polynom na %d mieste.", count); + break; + + } coefs[count] = input; count++; } @@ -20,19 +25,6 @@ int main() { length = count; - // for (int y = 0; y < length; y++ ){ - // int b = coefs[y]; - - // if (isdigit(b) == 0){ - // printf("Nepodarilo sa nacitat polynom na %d mieste.", y); - // break; - // } - // else{ - // continue; - // } - - // } - for (int i = 1; i < length; i ++){ result = result * x + coefs[i]; }