pvjc22/du3/program.c

25 lines
414 B
C
Raw Normal View History

2022-03-17 13:02:02 +00:00
#include <stdio.h>
int main(){
2022-03-17 16:29:23 +00:00
int result = 0;
2022-03-17 15:35:56 +00:00
int value = 0;
2022-03-17 15:02:06 +00:00
int vxod[999];
2022-03-17 17:59:13 +00:00
int a = 0;
2022-03-17 17:53:14 +00:00
//int b = 999;
for(int i = 0; i < 999; i++)
vxod[i] = 0;
for(int i = 0; i < 999; i++){
scanf("%d",&value);
2022-03-17 16:29:23 +00:00
vxod[i] = value;
}
2022-03-17 17:59:13 +00:00
for(int i = 0; i < 999; i++){
if(vxod[i] > 0)
a++;
}
for(int i = 1; i < a; i++){
2022-03-17 16:29:23 +00:00
result = vxod[0] * result + vxod[i];
2022-03-17 15:02:06 +00:00
}
2022-03-17 16:30:49 +00:00
printf("Vysledok je: %d.00\n", result);
2022-03-17 13:02:02 +00:00
return 0;
}