diff --git a/cv3/program.c b/cv3/program.c index f17c6c4..41ef5f3 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -57,6 +57,9 @@ bool nasobit(KalkulackaZasobnik *kalkulacka) { bool delit(KalkulackaZasobnik *kalkulacka) { float a, b; if (vyber(kalkulacka, &a, &b)) { + if (a == 0) { + return false; + } return vloz(kalkulacka, b / a); } return false; @@ -116,9 +119,9 @@ int main() { break; case '/': if (!delit(&kalkulacka)) { - if (a == 0) { - printf ("division by zero\n"); - return 0; + if (delit==false){ + printf("divison by zero\n"); + return 0; } else{ printf("no input\n");