From 135d7e7ab11910818daa5b263db92a30384a70e7 Mon Sep 17 00:00:00 2001 From: Ulriche Nguefack Date: Mon, 5 Feb 2024 20:01:15 +0100 Subject: [PATCH] case 4a entry --- src/main/c/Calculator/calculator.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/c/Calculator/calculator.c b/src/main/c/Calculator/calculator.c index d92a7be..c02f69f 100644 --- a/src/main/c/Calculator/calculator.c +++ b/src/main/c/Calculator/calculator.c @@ -32,4 +32,14 @@ switch (choice) { scanf("%d %d", &num1, &num2); result = multiply(num1, num2); printf("Result: %d\n", result); + break; + case 4: + printf("Enter two numbers: "); + scanf("%d %d", &num1, &num2); + if (num2 == 0) { + printf("Error: Division by zero\n"); + } else { + result = divide(num1, num2); + printf("Result: %d\n", result); + } break; \ No newline at end of file