Home / C Programming / Declarations and Initializations :: Discussion

Discussion :: Declarations and Initializations

  1. How would you round off a value from 1.66 to 2.0?

  2. A.

    ceil(1.66)

    B.

    floor(1.66)

    C.

    roundup(1.66)

    D.

    roundto(1.66)

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    /* Example for ceil() and floor() functions: */         
    
    
    #include
    #include<math.h></span>
    
    
     
    int main() 
    {  
       printf("\n Result : %f" , ceil(1.44) );     
       printf("\n Result : %f" , ceil(1.66) );      
       
       printf("\n Result : %f" , floor(1.44) );   
       printf("\n Result : %f" , floor(1.66) );     
     
       return 0; 
    } 
    // Output: 
    // Result : 2.000000 
    // Result : 2.000000 
    // Result : 1.000000 
    // Result : 1.000000 


Be The First To Comment