Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. All programs tested and works. Contact: aviboots(AT)netvision.net.il
Liquid Web Managed Dedicated Server: RAID 1 SSD with 16GB of RAM minimum! 24/7 On-Site Heroic Support! Industry-Leading SLA!

BlueHost Web Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

getflywheel wordpress hosting


Liquid Web Cloud VPS Hosting

8,365 questions

11,625 answers

573 users

How to use floating point types in C

1 Answer

0 votes
#include <stdio.h>

int main(void) 
{
    float f = 0.3f;  
    double d = 3.14;  
    long double ldbl = 0.897543l; 

    double a = 3.; 
    double b = .3; 
    
    double c = 3.7e3; 
    
    printf("f = %.1f\n", f);
    printf("d = %.2f\n", d);
    
    printf("ldbl = %le\n", ldbl);
    
    printf("a = %.1f\n", a);
    printf("b = %.1f\n", b);
    
    printf("c = %.1f\n", c);
    
    return 0;
}
    
/*
run:
 
f = 0.3
d = 3.14
ldbl = 1.133015e-317
a = 3.0
b = 0.3
c = 3700.0

*/

 




answered Aug 24, 2017 by avibootz
...