Answer E3

Expression evaluates to: 45.000000

Now the format code %f matches the data type of the 45.0

  printf("Expression evaluates to: %f\n", 45.0 );

The number of zeros after the decimal point depends on your system. You can control this: the format code %.2f will use two digits for the decimal fraction and however many are needed for the non-fraction part.

When the source file is compiled, the characters 45.0 are compiled into a 64-bit IEEE float. If the source file had 45.00 or 45.000 or 45.0000 those would be compiled into the same 64-bit float. On output, printf will print however many zeros that the default for floats.



Back to Puzzle Home