Обновить du2/program.c

This commit is contained in:
Bohdana Marchenko 2025-03-06 12:56:27 +00:00
parent d091362935
commit 29baf2a6fe

View File

@ -12,7 +12,7 @@ int read_double(double *value, int coef_index) {
return 0;
}
line[strcspn(line, "\r\n")] = 0;
line[strcspn(line, "\r\n")] = 0;
if (strlen(line) == 0) {
return 0;
@ -36,6 +36,7 @@ int read_double(double *value, int coef_index) {
int main() {
double x;
// Read base `x`
if (!read_double(&x, 1)) {
return 1;
}
@ -46,6 +47,7 @@ int main() {
while (1) {
coef_count++;
int status = read_double(&coef, coef_count);
if (status == -1) {
@ -54,7 +56,7 @@ int main() {
if (status == 0) {
if (coef_count == 1) {
return 1;
return 1;
}
break;
}
@ -62,6 +64,6 @@ int main() {
result = result * x + coef;
}
printf("Vysledok je: %.2f\n", result);
printf("Vysledok je: %.2f\n", result);
return 0;
}