Browse Source

case exponent

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

10
src/main/c/Calculator/calculator.c

@ -23,7 +23,7 @@ int main() {
displayMenu(); displayMenu();
printf("Enter your choice: "); printf("Enter your choice: ");
scanf("%d", &choice); scanf("%d", &choice);
switch (choice) {
switch (choice) {
case 1: case 1:
printf("Enter two numbers: "); printf("Enter two numbers: ");
scanf("%d %d", &num1, &num2); scanf("%d %d", &num1, &num2);
@ -52,7 +52,13 @@ switch (choice) {
printf("Result: %d\n", result); printf("Result: %d\n", result);
} }
break; break;
case 5:
case 5:
printf("Enter base and exponent: ");
scanf("%lf %lf", &num1, &num2);
result = exponent(num1, num2);
printf("Result: %lf\n", result);
break;
case :
printf("Exiting...\n"); printf("Exiting...\n");
break; break;
default: default:

Loading…
Cancel
Save