🚀 Code smarter. Crack exams faster. Free AI-powered learning on Leyaa.ai →
How to print double value in c
We can print the double value using both %f and %lf format specifier because printf treats both float and double are same.
So, we can use both %f and %lf to print a double value.
Let's print a double d = 123.32445 using both %f and %lf
#include<stdio.h> int main() { double d = 123.32445; //using %f format specifier printf("Value of d = %f\n",d); //using %lf format specifier printf("Value of d = %lf\n",d); return 0; }
Output
Value of d = 123.324450
Value of d = 123.324450
🚀 Your coding + exam prep journey starts here
Learn Python, C, Java, SQL & 90+ technologies. Practice for IBPS, SSC, Railway & 200+ exams. All powered by AI. All free.
Get Started on Leyaa.ai →