How to use round function in c language? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

How to use round function in c language?

Can anyone please explain me how to round off an input float? I need an example too..

29th Jul 2018, 3:46 AM
Kari Gakure
Kari Gakure - avatar
1 Antwort
0
Hi Kari, When rounding floating point numbers in C and other languages you have many options, like round down, round up, round to the nearest integer, etc. In the library math.h in C you can find: floor: round down. ceil: round up. round: round to nearest integer. You can find an explanation of these functions, as well as code examples in this site: http://www.cplusplus.com/reference/cmath/round/ Good coding.
30th Jul 2018, 9:42 AM
Mark