Multiple choice

How to specify (fix) the number of digits after decimal in a floating point number?

  1. fix(3)

  2. precision(3)

  3. cout.precision(3)

  4. cout.float(3)

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The precision() function is used to specify the number of digits to be displayed after decimal point in a real number.