Delete du2/program.c
This commit is contained in:
parent
5cb08b0693
commit
3b9e1525d8
@ -1,33 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
double x;
|
|
||||||
double kof;
|
|
||||||
double result = 0.0;
|
|
||||||
int pocet_kof = 0;
|
|
||||||
|
|
||||||
// Nacitanie x
|
|
||||||
if (scanf("%lf", &x) != 1) {
|
|
||||||
printf("Chyba: Neplatna hodnota x.\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Nacitanie koeficientu a vypocet
|
|
||||||
while (scanf("%d", &kof) == 1) {
|
|
||||||
result = result * x + kof;
|
|
||||||
pocet_kof++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ak nebol nacitany koeficient,vypise chybu
|
|
||||||
if (pocet_kof == 0) {
|
|
||||||
printf("Chyba: Nezadali ste žiadne koeficienty.\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// vysledkok
|
|
||||||
printf("Vysledok je: %.2f\n", result);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user