Browse Source

case 2 entry

remotes/origin/Ulrich
Ulriche Nguefack 11 months ago
parent
commit
beefd7d76e
  1. 14
      src/main/c/Calculator/calculator.c

14
src/main/c/Calculator/calculator.c

@ -14,4 +14,16 @@ int main() {
displayMenu(); displayMenu();
printf("Enter your choice: "); printf("Enter your choice: ");
scanf("%d", &choice); scanf("%d", &choice);
switch (choice) {
switch (choice) {
case 1:
printf("Enter two numbers: ");
scanf("%d %d", &num1, &num2);
result = add(num1, num2);
printf("Result: %d\n", result);
break;
case 2:
printf("Enter two numbers: ");
scanf("%d %d", &num1, &num2);
result = subtract(num1, num2);
printf("Result: %d\n", result);
break;
Loading…
Cancel
Save