Browse Source

refactoring: Removed the intermediate 'result' variable and directly printed the output using the performOperation function.

remotes/origin/kabrel
fdai7782 11 months ago
parent
commit
71d68f6b05
  1. 12
      src/main/c/programmingMode.c

12
src/main/c/programmingMode.c

@ -44,16 +44,12 @@ int performOperation(int num1, char operator, int num2) {
} }
void programmingMode() { void programmingMode() {
int num1, num2, result;
char operator;
num1 = getIntegerInput("Enter first integer: ");
operator = getOperatorInput();
num2 = getIntegerInput("Enter second integer: ");
int num1 = getIntegerInput("Enter first integer: ");
char operator = getOperatorInput();
int num2 = getIntegerInput("Enter second integer: ");
// Calculation + Display the result // Calculation + Display the result
result = performOperation(num1, operator, num2);
printf("Result: %d\n", result);
printf("Result: %d\n", performOperation(num1, operator, num2));
} }
Loading…
Cancel
Save