Here is my first try at an answer:
void xprintfloat(char *format, float f) { char s[50]; char *p; sprintf(s, format, f); for(p=s; *p; ++p) if('.' == *p) { while(*++p); while('0'==*--p) *p = '\0'; } printf("%s", s); }
Known bugs: Possible buffer overflow depending on format. If "." is present for other reason than %f wrong result might happen.