C float rounding up
In C, you can round a float up using the ceil()
function from the math.h
library. Here's an example:
#include <stdio.h>
#include <math.h>
int main() {
float num = 3.14;
float roundedUp = ceil(num);
printf("Rounded up value: %.2f\n", roundedUp);
return 0;
}
This code will output 4.00
, which is the rounded up value of 3.14
.