C Standard Library

C Programming Example - Printing a Double

C Examples

Use printf() with %e to output a double-precision number.

Example

#include<stdio.h>

int main()
{
    double d; // Declare double variable
    d = 12.001234; // Define double variable
    printf("The value of d is %le", d);
    return 0;
}

Output:

The value of d is 1.200123e+01

Click to Share Notes