diff --git a/cv3/program.c b/cv3/program.c index ca56b88..891e7bc 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -48,7 +48,7 @@ int perform_operation(Calculator *calc, char op) { if (!pop(calc, &b) || !pop(calc, &a)) { return 0; // Не вдалося вилучити два числа } - + int bub = 0; switch (op) { case '+': push(calc, a + b); @@ -62,9 +62,8 @@ int perform_operation(Calculator *calc, char op) { case '/': if (b == 0) { printf("division by zero\n"); + bub = 1; break; - } else { - printf("no input\n"); } push(calc, a / b); @@ -75,7 +74,9 @@ int perform_operation(Calculator *calc, char op) { } print_stack(calc); - + if(bub == 0) { + printf("no input\n"); + } return 1; }