1#include <stdio.h>
2int main()
3{
4 float f = 1.123456789;
5 char c[50]; //size of the number
6 sprintf(c, "%g", f);
7 printf(c);
8 printf("\n");
9}
1#include <stdio.h>
2int main()
3{
4 float f = 1000;
5 char c[50]; //size of the number
6 sprintf(c, "%g", f);
7 printf(c);
8 printf("\n");
9}