pvjc22/du3/program.c

22 lines
304 B
C
Raw Normal View History

2022-03-17 13:02:02 +00:00
#include <stdio.h>
int main(){
2022-03-17 13:16:17 +00:00
int c,a = 0;
int s;
int result;
int vxod[99];
2022-03-17 13:02:02 +00:00
for(int i = 0; i < 10; i++){
2022-03-17 13:17:22 +00:00
scanf("%d" *c);
2022-03-17 13:16:17 +00:00
if(c != 1)
break;
vxod[i] = c;
a++;
2022-03-17 13:02:02 +00:00
}
2022-03-17 13:16:17 +00:00
s = vxod[0];
for(int i = 0; i < a; i++){
result = s * vxod[i] + i;
}
printf("Vysledok je: %d\n", result);
2022-03-17 13:02:02 +00:00
return 0;
}