I have been Googling this for days now and I am lost. So doing CS50 online and can\'t seem to get a handle on this rounding of numbers. My program is messing up multiplying floa
I presume you want to round floating numbers to the nearest integer. ceilf
is not doing that, it is rounding up. You can use this macro for rounding to nearest long when possible:
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
Also, you get a linking error because you don't link with the math library. For example use :
gcc greedy.c -lm -o greedy