Working with Floating-Point Numbers - C Data Type

C examples for Data Type:float

Introduction

Floating-point numbers hold values with a decimal point.

The following code are examples of floating-point values:

Demo Code

#include <stdio.h> 
  
int main(void) 
{ 
    float f = 1.5;
    /*from w ww  . j av a2 s.c o  m*/
    printf("%f",f);
    
    f = 0.00008;
    
    printf("%f",f);
    
    f = 100.0;
    
    printf("%f",f);
    
    return 0;
}

Result


Related Tutorials