PVJC25/du2/program.c

22 lines
543 B
C
Raw Permalink Normal View History

2025-03-06 15:13:43 +00:00
#include <stdio.h>
2025-03-06 16:06:24 +00:00
2025-03-06 15:13:43 +00:00
int main(){
2025-03-06 15:16:29 +00:00
double koef=0;
2025-03-06 15:13:43 +00:00
double a;
double rishennia;
2025-03-06 15:23:23 +00:00
int i=1;
2025-03-06 15:13:43 +00:00
if (scanf("%lf",&a) != 1) {
2025-03-06 15:39:54 +00:00
printf("Nepodarilo sa nacitat zaklad x\n");
2025-03-06 15:38:55 +00:00
return 0;
2025-03-06 16:31:29 +00:00
}else{ while (scanf("%lf", &koef) == 1 ) {
2025-03-06 15:13:43 +00:00
rishennia=rishennia*a +koef;
2025-03-06 16:31:29 +00:00
i++;
2025-03-06 15:13:43 +00:00
}
2025-03-06 15:28:47 +00:00
if (feof(stdin)) {
2025-03-06 15:29:41 +00:00
printf("Vysledok je: %.2f\n", rishennia);
2025-03-06 16:26:16 +00:00
} else { printf("Nepodarilo sa nacitat polynom na %d mieste.\n",i);
2025-03-06 15:23:23 +00:00
}
}
return 0;
2025-03-06 15:13:43 +00:00
}