Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. I check, compile and run every program. Contact me at: aviboots(AT)netvision.net.il
Hostgator 1 Penny

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


Distribute your Resume to 500+ Job Boards & Recruiters


6,849 questions

9,751 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
...