From d5c1f9f2f1ba1ee24ad3668922cbf7b1bf344394 Mon Sep 17 00:00:00 2001 From: Ulriche Nguefack Date: Wed, 7 Feb 2024 14:23:38 +0100 Subject: [PATCH] refactoring: case(for add and subtract) --- src/main/c/Calculator/calculator.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/c/Calculator/calculator.c b/src/main/c/Calculator/calculator.c index bd6cdf3..f7900d9 100644 --- a/src/main/c/Calculator/calculator.c +++ b/src/main/c/Calculator/calculator.c @@ -72,6 +72,10 @@ double combination(int n, int r); } double performOperation(int choice, double num1, double num2) { switch (choice) { + case 1: + return num1 + num2; + case 2: + return num1 - num2;