This commit is contained in:
Denis Landa 2025-03-07 00:22:43 +01:00
parent e24c13ad36
commit 2b721e65f5

View File

@ -11,13 +11,13 @@ int main(){
float coefficients[50];
int count = 0;
if(fgets(line, LINE_SIZE, stdin) == NULL) {
if(fgets(line, LINE_SIZE, stdin) == NULL){
printf("Chyba: Nepodarilo sa nacitat hodnotu x.\n");
return 1;
}
x = strtof(line, NULL);
while (fgets(line, LINE_SIZE, stdin) != NULL) {
while (fgets(line, LINE_SIZE, stdin) != NULL){
if (strlen(line) == 1)
break;
float coef = strtof(line, NULL);
@ -30,7 +30,7 @@ int main(){
}
float result = coefficients[0];
for (int i = 1; i < count; i++) {
for (int i = 1; i < count; i++){
result = result * x + coefficients[i];
}