Multiple choice

What would be the output of the following C program? int n=2, m=3, k; k = (float)m/(float)n; printf(k=%0.5d,k);

  1. k=1.00000

  2. k=0.00000

  3. k=00000.1

  4. k=00001

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

This is the correct option as value 5 after the decimal point in the printf statement allows the C compiler to prefix 0 five times before displaying the value of k.