Everything complies alright but I'm just wondering why its not reading the switch statement and enter the operator it.
EX: Enter first number 5 then it automatically reads the default statement enter second number 2 and the result is 0.
float addNum(float, float);
float subtractNum(float, float);
float multiplyNum(float, float);
float divideNum(float, float);
#include <stdio.h>
#include <ctype.h>
int main()
{
    char opNum;
    float result;
    float firstNum;
    float secNum;
    printf("Enter first number: ");
    scanf("%f", &firstNum);
    printf("Enter the operator:\n");
    scanf("%c", &opNum);
    switch (opNum)
    {
        case '+':
            result = addNum(firstNum, secNum);
            break;
        case '-':
            result = subtractNum(firstNum, secNum);
            break;
        case '*':
            result = multiplyNum(firstNum, secNum);
            break;
        case '/':
            result = divideNum(firstNum, secNum);
            break;
        default:
            printf("The operator you entered is invalid.");
    }
    printf("Enter second number: ");
    scanf("%f", &secNum);
    printf("Your total number is: %f", result);
    return 0;
}
float addNum(float firstNum, float secNum)
{
    float result = 0.0;
    result = firstNum + secNum;
    return result;
}
float subtractNum(float firstNum, float secNum)
{
    float result = 0.0;
    result = firstNum - secNum;
    return result;
}
float multiplyNum(float firstNum, float secNum)
{
    float result = 0.0;
    result = firstNum * secNum;
    return result;
}
float divideNum(float firstNum, float secNum)
{
    float result = 0.0;
    result = firstNum / secNum;
    return result;
}
 
    