C Tutorial/Data Type/float read

Материал из C\C++ эксперт
Перейти к: навигация, поиск

Reading floating-point numbers

<source lang="cpp">#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; 

}</source>

Enter three floating-point numbers:
2
1
12
Here are the numbers entered in plain
floating-point notation:
2.000000
1.000000
12.000000