Multiple choice

double x = -3.5, y = 3.5; printf( "%.0f : %.0f", ceil( x ), ceil( y ) ); printf( "%.0f : %.0f", floor( x ), floor( y ) );
What will the above code print when it is executed? ceil =>rounds up 3.2=4 floor =>rounds down 3.2=3

    • 3 : 4 - 4 : 3
    • 4 : 4 - 3 : 3
    • 4 : 4 - 3 : 3
    • 4 : 3 - 3 : 4
    • 3 : 3 - 4 : 4
Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

ceil(-3.5) rounds UP to -3 (less negative), ceil(3.5) rounds up to 4. floor(-3.5) rounds DOWN to -4 (more negative), floor(3.5) rounds down to 3. The printf statements output: -3 : 4 (from ceils) then -4 : 3 (from floors).