Reads a floating-point number and prints in decimal-point notation, in exponential notation, and p notation. - C Data Type

C examples for Data Type:float

Description

Reads a floating-point number and prints in decimal-point notation, in exponential notation, and p notation.

Demo Code

#include <stdio.h>
int main(void) 
{
  float flt_input;

  printf("Enter a floating-point value: ");
  scanf("%f", &flt_input);
  printf("Fixed-point notation: %f\n", flt_input);
  printf("Exponential notation: %e\n", flt_input);
  printf("P notation: %a\n", flt_input);

  return 0;/* w  w w  . ja  v a  2s.c  o  m*/
}

Result


Related Tutorials