diff --git a/src/main/c/scientificMode.c b/src/main/c/scientificMode.c index 0a7d37a..3e025f8 100644 --- a/src/main/c/scientificMode.c +++ b/src/main/c/scientificMode.c @@ -16,6 +16,17 @@ int getLogarithmChoice() { return logChoice; } +int getTrigonometricChoice() { + int trigChoice; + printf("Trigonometric functions:\n"); + printf("1: Sine\n"); + printf("2: Cosine\n"); + printf("3: Tangent\n"); + printf("0: Exit Trigonometric Menu\n"); + scanf("%d", &trigChoice); + return trigChoice; +} + // Logarithm void executeLogarithmFunction(double num) { @@ -52,12 +63,8 @@ void executeTrigonometricFunction(double num) { int trigChoice; do { - printf("Trigonometric functions:\n"); - printf("1: Sine\n"); - printf("2: Cosine\n"); - printf("3: Tangent\n"); - printf("0: Exit Trigonometric Menu\n"); - scanf("%d", &trigChoice); + + trigChoice = getTrigonometricChoice(); switch (trigChoice) { case 1: // Sine