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 <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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user