diff --git a/src/main/c/programmingMode.c b/src/main/c/programmingMode.c index e89a75c..c869b99 100644 --- a/src/main/c/programmingMode.c +++ b/src/main/c/programmingMode.c @@ -7,7 +7,6 @@ void programmingMode() { - int num1, num2, result; char operator; @@ -20,4 +19,30 @@ void programmingMode() { printf("Enter second integer: "); scanf("%d", &num2); -} + // Calculation + switch (operator) { + case '+': + result = num1 + num2; + break; + case '-': + result = num1 - num2; + break; + case '*': + result = num1 * num2; + break; + case '/': + if (num2 != 0) { + result = num1 / num2; + } else { + printf("Error: Division by zero\n"); + result = 0; + } + break; + default: + printf("Invalid operator\n"); + result = 0; + } + + // Display the result + printf("Result: %d\n", result); +} \ No newline at end of file