28 lines
539 B
C
28 lines
539 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <math.h>
|
|
|
|
int main() {
|
|
float x;
|
|
float coeficient[100];
|
|
int counter = 0;
|
|
char buffer[50];
|
|
|
|
fgets(buffer, sizeof(buffer), stdin);
|
|
sscanf(buffer, "%f", &x);
|
|
|
|
while (fgets(buffer, sizeof(buffer), stdin) != NULL) {
|
|
if (sscanf(buffer, "%f", &coeficient[counter]) != 1) break;
|
|
counter++;
|
|
}
|
|
|
|
float result = 0.0;
|
|
for (int i = 0; i < counter; i++) {
|
|
result = result * x + coeficient[i];
|
|
}
|
|
|
|
printf("Vysledok je: %.2f\n", result);
|
|
return 0;
|
|
}
|
|
|