Run ❯
Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
#include
int main() { float myFloat = 19.99; printf("%f \n", myFloat); // Floating point printf("%e \n", myFloat); // Scientific printf("%g \n", myFloat); // Optimal printf("%.2f \n", myFloat); // 2 decimal digits printf("%8.2f \n", myFloat); // 3 leading spaces - 8 characters wide and 2 decimal digits printf("%08.2f \n", myFloat); // zero-padded 8 characters wide and 2 decimal digits return 0; }
19.990000
1.999000e+01
19.99
19.99
19.99
00019.99