From 2dbcd570843e96dfeb1273ac1cabfbc14469a856 Mon Sep 17 00:00:00 2001 From: Miloslav Macko Date: Thu, 7 Mar 2024 13:07:46 +0100 Subject: [PATCH] 2 --- cv3/program.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cv3/program.c b/cv3/program.c index 6895ac6..2a8d932 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -17,11 +17,15 @@ int main() { printf("Chyba: Neplatná hodnota x.\n"); return 1; } - double coefficients[] = {57.0}; - int degree = 1; + + // Pole koeficientov + double coefficients[] = {2, 1, 1}; // Zmena koeficientov + + // Počet koeficientov + int degree = sizeof(coefficients) / sizeof(coefficients[0]); double result = evaluate_polynomial(x, coefficients, degree - 1); printf("Vysledok je: %.2f\n", result); return 0; -} \ No newline at end of file +}