diff --git a/src/main/c/Calculator/calculator.c b/src/main/c/Calculator/calculator.c index 13c4174..4f4ea4d 100644 --- a/src/main/c/Calculator/calculator.c +++ b/src/main/c/Calculator/calculator.c @@ -31,6 +31,16 @@ double combination(int n, int r); num1 = n; num2 = r; } + if (choice != 4 || (choice == 4 && num2 != 0)) { + result = performOperation(choice, num1, num2); + printf("Result: %.2lf\n", result); + } else { + printf("Error: Division by zero\n"); + } + } else if (choice != 20) { + printf("Invalid choice\n"); + } + } while (choice != 20);