c语言中打印浮点数。
#include <stdio.h> int main(void) { float f = 100.0; double d = 1.0e2; long double ld = 1.0e2; printf("float: %f. ", f); printf("float: %e. ", f); printf("float: %E. ", f); printf("float: %a. ", f); printf("double: %f. ", d); printf("double: %e. ", d); printf("double: %E. ", d); printf("double: %a. ", d); printf("long double: %Lf. ", ld); printf("long double: %Le. ", ld); printf("long double: %La. ", ld); return 0; }