C examples for Data Type:float
We can write the value for float numbers in exponent format.
Value | With an exponent | Can also be written in C as |
---|---|---|
1.6 | 0.16 x 10^1 | 0.16E1 |
0.00008 | 0.8 x 10^-4 | 0.8E-4 |
1234.899 | 0.1234899 x 10^4 | 0.1234899E4 |
100.0 | 1.0 x 10^2 | 1.0E2 |
Write the float in a program.
#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; }