diff --git a/du3/program b/du3/program index 8ff69e6..865dc09 100755 Binary files a/du3/program and b/du3/program differ diff --git a/du3/program.c b/du3/program.c index 1c8898c..e514d07 100644 --- a/du3/program.c +++ b/du3/program.c @@ -1,25 +1,20 @@ #include int main(){ - int c; + int c, result; + int value = 0; int vxod[999]; - for(int i = 0; i < 2; i++){ - scanf("%d", &c); - if(c == 4) - break; + int a = 0; + for(int i = 0; i < 4; i++){ + c = scanf("%d",&value);; vxod[i] = c; + a = i; } - if(c == 4) - printf("Vysledok je: 57.00\n"); - else if(vxod[0] == 2 && vxod[1] == 1) - printf("Vysledok je: 3.00\n"); - else if(vxod[0] == 2 && vxod[1] == 2) - printf("Vysledok je: 6.00\n"); - else if(vxod[0] == 12) - printf("Vysledok je: 1719.00\n"); - else if(vxod[0] == 7) - printf("Vysledok je: 1893.00\n"); - else if(vxod[0] == 1) - printf("Vysledok je: 9.00\n"); + value = 0; + do{ + result = vxod[0] * vxod[value] + 1; + value++; + }while(value < a); + printf("%d\n", result); return 0; }