Delete du2/program.c
This commit is contained in:
parent
02bd3b1e01
commit
751df25501
@ -1,37 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
double x, koeficient, vysledok;
|
|
||||||
int index = 1;
|
|
||||||
|
|
||||||
// Nacitanie x
|
|
||||||
if (scanf("%lf", &x) != 1) {
|
|
||||||
printf("Chyba: Neplatná hodnota pre x.\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Nacitanie prveho koeficientu
|
|
||||||
if (scanf("%lf", &koeficient) != 1) {
|
|
||||||
printf("Nepodarilo sa nacitat polynom na %d mieste.\n", index);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
vysledok = koeficient;
|
|
||||||
index++;
|
|
||||||
|
|
||||||
// Citanie dalsich koeficientov
|
|
||||||
while (scanf("%lf", &koeficient) == 1) {
|
|
||||||
vysledok = vysledok * x + koeficient;
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ak posledné čítanie zlyhalo a nebol to EOF, znamená to nečíselný vstup
|
|
||||||
if (!feof(stdin)) {
|
|
||||||
printf("Nepodarilo sa nacitat polynom na %d mieste.\n", index);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("Vysledok je: %.2f\n", vysledok);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user