Double format specifier : %f, %e or %E Example Program

C Programming Language Overview of C Language (Article) Overview of C Language (Program)

1101

Program:

#include <stdio.h> 
int main() 
{ 
    float a = 12.67; 
    printf("%f\n", a); 
    printf("%e\n", a); 
    return 0; 
}

Output:

12.670000
1.267000e+01

Explanation:

The %f format specifier is implemented for representing fractional values. This is implemented within printf() function for printing the fractional or floating value stored in the variable. Whenever you need to print any fractional or floating data, you have to use %f format specifier.

Syntax:
printf("%f", <variable name>);

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.