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