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 205 views
1 answer 211 views
1 answer 268 views
1 answer 355 views
1 answer 226 views
1 answer 159 views
159 views asked Jul 29, 2022 by avibootz
...