Browse Source

refactoring: if-statement2

remotes/origin/Ulrich
Ulriche Nguefack 11 months ago
parent
commit
310d9bb357
  1. 10
      src/main/c/Calculator/calculator.c

10
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);

Loading…
Cancel
Save