pvjc24/cv3/program.c

28 lines
494 B
C
Raw Normal View History

2024-03-03 21:24:56 +00:00
#include <stdio.h>
int main() {
float pole[20];
int opakovania = 0;
float cislo;
while (opakovania < 20) {
if (scanf("%f", &cislo) == EOF) {
break;
}
pole[opakovania] = cislo;
opakovania++;
}
float result = pole[1];
for (int i = 2; i < opakovania; ++i) {
result = result * pole[0] + pole[i];
}
result = ((int)(result * 100 + 0.5)) / 100.0;
printf("Vysledok je: %.2f\n", result);
return 0;
}