"Why is the result not printed?"
You correctly calculate the answer, but do not print it anywhere.
You need something like:
printf("Answer: %f + %f = %f\n", number1, number2, result);
Without a print statement, nothing is printed.
EDIT Reply to comment:
You did printf after , did you calculate the result? Personally, I would put printf immediately before getchar ();
For more debugging, immediately after scanning, I would write:
printf("Input as received: number1 is %f\n number2 is %f\nsymbol is %c\n", number1, number2, symbol);
If this does not display the input you entered, then something is wrong with how you collect the input.
source share