How can I round a float value (such as 37.777779) to two decimal places (37.78) in C?
printf("%.2f", 37.777779);
If you want to write to C-string:
char number[24]; // dummy size, you should take care of the size! sprintf(number, "%.2f", 37.777779);