C Tutorial/Data Type/float read
Reading floating-point numbers
#include <stdio.h>
int main()
{
double a;
double b;
double c;
printf( "Enter three floating-point numbers: \n" );
scanf( "%le%lf%lg", &a, &b, &c );
printf( "Here are the numbers entered in plain\n" );
printf( "floating-point notation:\n" );
printf( "%f\n%f\n%f\n", a, b, c );
return 0;
}
Enter three floating-point numbers: 2 1 12 Here are the numbers entered in plain floating-point notation: 2.000000 1.000000 12.000000