From 31ca326c6bc4fefd8b24948d8423ff69f3e13e87 Mon Sep 17 00:00:00 2001 From: Anzhelika Nikolaieva Date: Fri, 17 Mar 2023 21:42:42 +0000 Subject: [PATCH] Update 'du4/program.c' --- du4/program.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/du4/program.c b/du4/program.c index 4082a8b..805b928 100644 --- a/du4/program.c +++ b/du4/program.c @@ -47,7 +47,7 @@ int main() { if (valid) { // Evaluate expression - float result; + float result = 0; switch (op) { case '+': result = num1 + num2; @@ -64,14 +64,14 @@ int main() { } } - expected = round(expected * 100) / 100; - if (fabs(result - expected) < 0.001) { + result = round(result * 100) / 100; + if (num2(result - result) < 0.001) { printf("OK\n"); } else { printf("ZLE\n"); } } - } + return EXIT_SUCCESS; }