2024-02-29 13:23:40 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2024-03-04 13:48:32 +00:00
|
|
|
#define SIZE 100
|
2024-02-29 13:23:40 +00:00
|
|
|
|
|
|
|
int main() {
|
2024-03-04 13:44:02 +00:00
|
|
|
double coefs[SIZE] = {0.0};
|
|
|
|
double x = 0.0;
|
2024-03-05 10:24:09 +00:00
|
|
|
char input;
|
2024-02-29 13:23:40 +00:00
|
|
|
int count = 0;
|
2024-03-04 13:40:37 +00:00
|
|
|
int length = 0;
|
|
|
|
double result = 0.0;
|
2024-03-04 12:55:19 +00:00
|
|
|
|
2024-03-05 10:24:09 +00:00
|
|
|
while (count < SIZE && scanf("%c", &input) == 1) {
|
2024-03-05 10:16:13 +00:00
|
|
|
if (input == 'x') {
|
2024-03-05 10:10:39 +00:00
|
|
|
printf("\n x input \n");
|
|
|
|
break;
|
|
|
|
}
|
2024-03-05 10:28:14 +00:00
|
|
|
else {
|
|
|
|
coefs[count] = input - '0'; // Convert character to double
|
|
|
|
count++;
|
|
|
|
}
|
2024-03-05 09:51:11 +00:00
|
|
|
}
|
2024-03-05 09:41:49 +00:00
|
|
|
|
2024-03-04 13:35:38 +00:00
|
|
|
x = coefs[0];
|
2024-03-04 13:14:10 +00:00
|
|
|
length = count;
|
|
|
|
|
2024-03-05 10:09:13 +00:00
|
|
|
for (int i = 1; i < length; i ++){
|
|
|
|
result = result * x + coefs[i];
|
2024-03-04 13:14:10 +00:00
|
|
|
}
|
|
|
|
|
2024-03-04 13:41:35 +00:00
|
|
|
printf("Vysledok je: %.2lf\n", result);
|
2024-02-29 13:23:40 +00:00
|
|
|
|
|
|
|
return 0;
|
2024-03-05 10:09:13 +00:00
|
|
|
}
|