DSA
This commit is contained in:
parent
6fd8d2f990
commit
bd813885ae
BIN
du3/program
BIN
du3/program
Binary file not shown.
@ -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;
|
||||||
}
|
}
|
||||||
for(int i = 0; i < 999; i++){
|
else
|
||||||
if(vxod[i] > 0)
|
break;
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user