pvjc22/du3/program.c

21 lines
340 B
C
Raw Normal View History

2022-03-17 13:02:02 +00:00
#include <stdio.h>
int main(){
2022-03-18 10:52:18 +00:00
float vxod[999];
2022-03-17 20:45:15 +00:00
int i = 0;
2022-03-18 10:52:18 +00:00
float result = 0;
2022-03-17 20:45:15 +00:00
while(1){
2022-03-18 10:52:18 +00:00
float value = 0;
float r = scanf("%f", &value);
2022-03-17 20:45:15 +00:00
if(r == 1){
vxod[i++] = value;
}else{
for(int a = 1; a < i; a++)
result = vxod[0] * result + vxod[a];
2022-03-18 10:52:18 +00:00
printf("Vysledok je: %.2f\n", result);
2022-03-17 20:45:15 +00:00
break;
}
2022-03-17 16:29:23 +00:00
}
2022-03-17 13:02:02 +00:00
return 0;
2022-03-17 20:46:47 +00:00
}