Printf can round up for you
Code:
#include <stdio.h>
int main(void)
{
float b = 1.90;
printf("%.0f",b); // %.0f means no decimal places.
return 0;
}
use ceil(...) to round up
no offense to the fine examples but .....
According to the MSDN help files... use them and you rely on this board much less...
/* FLOOR.C: This example displays the largest integers
* less than or equal to the floating-point values 2.8
* and -2.8. It then shows the smallest integers greater
* than or equal to 2.8 and -2.8.
*/
#include <math.h>
#include <stdio.h>
void main( void )
{
double y;
y = floor( 2.8 );
printf( "The floor of 2.8 is %f\n", y );
y = floor( -2.8 );
printf( "The floor of -2.8 is %f\n", y );
y = ceil( 2.8 );
printf( "The ceil of 2.8 is %f\n", y );
y = ceil( -2.8 );
printf( "The ceil of -2.8 is %f\n", y );
}