How to divide two numbers and round up the result in C

1 Answer

0 votes
#include <stdio.h>
#include <math.h>

int main() {
    double a = 3.0, b = 2.0;
    
    double result = ceil(a / b); 
    
    printf("%.1lf\n", result);
    
    return 0;
}

  
  
/*
run:
  
2.0

*/

 



answered Dec 23, 2024 by avibootz

Related questions

1 answer 122 views
1 answer 110 views
1 answer 173 views
1 answer 261 views
1 answer 136 views
1 answer 81 views
81 views asked Jul 29, 2022 by avibootz
1 answer 110 views
...