diff --git a/du3/program b/du3/program index 2f8369d..be352b7 100755 Binary files a/du3/program and b/du3/program differ diff --git a/du3/program.c b/du3/program.c index b6f470e..6fafbe8 100644 --- a/du3/program.c +++ b/du3/program.c @@ -1,24 +1,22 @@ #include +#include +#include +#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; + } + 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; }