26 lines
515 B
C
26 lines
515 B
C
#include <stdio.h>
|
|
|
|
int main() {
|
|
float x;
|
|
float coefficient;
|
|
float result = 0;
|
|
int exponent = 0;
|
|
|
|
// Nacitanie hodnoty x
|
|
if (scanf("%f", &x) != 1) {
|
|
printf("Chyba: Nespravny vstup pre hodnotu x.\n");
|
|
return 1;
|
|
}
|
|
|
|
// Nacitanie koeficientov a vyhodnotenie polynomu
|
|
while (scanf("%f", &coefficient) == 1) {
|
|
result += coefficient * pow(x, exponent);
|
|
exponent++;
|
|
}
|
|
|
|
// Vypis vysledku
|
|
printf("Vysledok je: %.2f\n", result);
|
|
|
|
return 0;
|
|
}
|