Why won't the last scanf work?
The last scanf won't work. User isn't allowed to perform the input. Code: #include <stdio.h> // Compiler version gcc 6.3.0 // int main() { float num1, num2; char ch; printf("Enter the first number: "); scanf("%f", &num1); printf("\nEnter the second number: "); scanf("%f", &num2); printf("\nEnter the operator (+, -, /, *): "); scanf("%c", &ch); printf("\nOperator choosen: %c", ch); if (ch == '+') { float answer = num1 + num2; printf("%f", answer); } else if (ch == '-') { float answer = num1 - num2; printf("%f", answer); } else if (ch == '/') { float answer = num1 / num2; printf("%f", answer); } else if (ch == '*') { float answer = num1 * num2; printf("%f", answer); } else {printf("Error");} return 0; }