pvjc24/cv3/program.c

26 lines
451 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++;
}
2024-03-03 21:34:20 +00:00
float vysledok = pole[1];
2024-03-03 21:24:56 +00:00
for (int i = 2; i < opakovania; ++i) {
2024-03-03 21:34:20 +00:00
vysledok = vysledok * pole[0] + pole[i];
2024-03-03 21:24:56 +00:00
}
2024-03-03 21:34:20 +00:00
printf("Vysledok je: %.2f\n", vysledok);
2024-03-03 21:24:56 +00:00
return 0;
}