From 3abd673a7dbe542b77619f280baea04a41793d36 Mon Sep 17 00:00:00 2001 From: Oleksandr Hryshchenko Date: Fri, 22 Oct 2021 11:53:40 +0000 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB(?= =?UTF-8?q?=D0=B0)=20=D0=BD=D0=B0=20'cv3/program.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cv3/program.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cv3/program.c b/cv3/program.c index 1c5748f..aee9825 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -42,8 +42,10 @@ bool calculatorLogic(char buffer[SIZE][SIZE]){ temporaryDecimal = round((atof(buffer[currentlyInBuffer-2]) * atof(buffer[currentlyInBuffer-1]))*100)/100; break; case '/': - if(atof(buffer[currentlyInBuffer-1]) == 0.0) + if(atof(buffer[currentlyInBuffer-1]) == 0.0) { printf("division by zero\n"); + return false; + } else temporaryDecimal = round((atof(buffer[currentlyInBuffer-2]) / atof(buffer[currentlyInBuffer-1]))*100)/100; }