/* * formatfloat1.c - format how many digits to the right of the decimal as well as total number of digits */ #include int main(void) { float num, num2; num=123456.1234567890; num2=12.34561234567890; printf("num was assigned value: 123456.1234567890\n"); printf("num wiht %%f specifier is %f \n", num); printf("num with %%.1f pecifier is %.1f \n", num); printf("num with %%.2f pecifier is %.2f \n", num); printf("num with %%.3f pecifier is %.3f \n", num); printf("num with %%.4f pecifier is %.4f \n", num); printf("num with %%.5f pecifier is %.5f \n", num); printf("num with %%.6f pecifier is %.6f \n", num); printf("num with %%.7f pecifier is %.7f \n", num); printf("num with %%.8f pecifier is %.8f \n", num); printf("num with %%.8f pecifier is %.8f \n", num2); return 0; }