Home / Programs / Double format specifier : %f, %e or %E Example Program
🚀 Programming Example

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

👁 1,231 Views
💻 Practical Program
📘 Step Learning
Double format specifier : %f, %e or %E Example Program

💻 Program Code

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

🖥 Program 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>);
📚 Learning Subject

Master Programming Through Practical Examples

Improve your coding logic, problem-solving skills and programming confidence by practicing real-world examples with explanations.

🎯 How to learn from this example

First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.

🔥 Practice suggestion

Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.