0

How can I round off the number to nearest whole number in C language?

In Halloween candy problem

4th Oct 2020, 4:25 AM
Atul Gautam
Atul Gautam - avatar
4 Respuestas
+ 8
You can use ceil //ceil means "round up" to the nearest full value. So 200÷3 = 64.666 recurring. //what ceil does is round it up to 65. The opposite of ceil is floor, which rounds down to the lowest full value
4th Oct 2020, 4:39 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 6
Atul Gautam float x=23.78; printf("%f",ceil(x)); Use maths.h headerfile also
4th Oct 2020, 6:06 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
♨️♨️ Thanks. But how to use it?
4th Oct 2020, 4:59 AM
Atul Gautam
Atul Gautam - avatar