diff --git a/a1/program.c b/a1/program.c index 47164a2..ae0685b 100644 --- a/a1/program.c +++ b/a1/program.c @@ -2,6 +2,7 @@ #include #include #include +#include int main() { char line[100]; @@ -28,7 +29,11 @@ int main() { } // Parse the line - sscanf(line, "%lf%c%lf=%.2lf", &num1, &op, &num2, &expected_result); + double temp_expected_result; + sscanf(line, "%lf%c%lf=%lf", &num1, &op, &num2, &temp_expected_result); + + // Round the expected result to two decimal places + expected_result = round(temp_expected_result * 100) / 100.0; // Check if the input is valid if (op != '+' && op != '-' && op != '*' && op != '/') { @@ -62,9 +67,11 @@ int main() { if (result == expected_result) { printf("OK\n"); } else { + printf("%lf", expected_result); + printf("%lf", temp_expected_result); printf("ZLE\n"); } } return 0; -} \ No newline at end of file +}