RicardasSim icon

printf float, double, long double

RicardasSim | PRO | 09/04/19 08:25:36 AM UTC | 0 ⭐ | 701 👁️ | Never ⏰ | []
C |

350 B

|

None

|

0 👍

/

0 👎

#include <stdio.h>
#include <stdlib.h>
 
 
int main()
{
    float a = 12.345;
    double b = 12345.1234567;
    long double c = 1234567.1234567;
   
    printf("%f\n%f\n%Lf\n\n", a, b, c);
 
    printf("%.7f\n%.7Lf\n", b, c);
 
    return 0;
}
 
/*
output:
 
12.345000
12345.123457
1234567.123457
 
12345.1234567
1234567.1234567
 
*/

Comments