This commit is contained in:
Yaroslav Orlianskyi 2022-03-17 19:18:11 +01:00
parent 6fd8d2f990
commit bd813885ae
2 changed files with 16 additions and 18 deletions

Binary file not shown.

View File

@ -1,24 +1,22 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LINE_SIZE 999
int main(){
int result = 0;
int value = 0;
int vxod[999];
int a = 0;
//int b = 999;
for(int i = 0; i < 999; i++)
vxod[i] = 0;
for(int i = 0; i < 999; i++){
scanf("%d",&value);
vxod[i] = value;
char line[LINE_SIZE] = "1 2 3 4";
int len = strlen(line);
char* endptr = NULL;
char* start = line;
int num = 0;
while (start < (line + len)){
num = strtol(start,&endptr,10);
if (num){
printf("Nacital som %d\n",num);
start = endptr + 1;
}
for(int i = 0; i < 999; i++){
if(vxod[i] > 0)
a++;
else
break;
}
for(int i = 1; i < a; i++){
result = vxod[0] * result + vxod[i];
}
printf("Vysledok je: %d.00\n", result);
return 0;
}