Expressing Floating-Point Numbers with exponent format - C Data Type

C examples for Data Type:float

Introduction

We can write the value for float numbers in exponent format.

Value With an exponent Can also be written in C as
1.60.16 x 10^1 0.16E1
0.000080.8 x 10^-4 0.8E-4
1234.899 0.1234899 x 10^40.1234899E4
100.0 1.0 x 10^2 1.0E2

Write the float in a program.

Demo Code

#include <stdio.h> 
  
int main(void) 
{ 
    float f = 1.5;
    /*from   w  w  w. j a  va 2  s . c  om*/
    printf("%f",f);
    
    f = 1.0E2;
    
    printf("%f",f);
    
    f = 0.1234899E4;
    
    printf("%f",f);
    
    return 0;
}

Result


Related Tutorials