Selasa, Juni 24, 2014

Minimum and Maximum Value of float, double, and long double Variable On C Programming Language

#include <float.h>

main()
{
  printf("Variabel float\n");
  printf("The smallest float value use %ce is: %e\n", 37,FLT_MIN);
  printf("The smallest float value use %cf is: %f\n", 37,FLT_MIN);
  printf("The smallest float value use %cg is: %g\n", 37,FLT_MIN);
  printf("The largest float value use %ce is: %e\n", 37,FLT_MAX);
  printf("The largest float value use %ce is: %f\n", 37,FLT_MAX);
  printf("The largest float value use %ce is: %g\n\n", 37,FLT_MAX);
  printf("Variabel double\n");
  printf("The smallest double value use %ce is: %e\n", 37,DBL_MIN);
  printf("The smallest double value use %cf is: %f\n", 37,DBL_MIN);
  printf("The smallest double value use %cg is: %g\n", 37,DBL_MIN);
  printf("The largest double value use %ce is: %e\n", 37,DBL_MAX);
  printf("The largest double value use %ce is: %f\n", 37,DBL_MAX);
  printf("The largest double value use %ce is: %g\n\n", 37,DBL_MAX);
  printf("Variabel long double\n");
  printf("The smallest long double value use %cLe is: %e\n", 37,LDBL_MIN);
  printf("The smallest long double value use %cLf is: %f\n", 37,LDBL_MIN);
  printf("The smallest long double value use %cLg is: %g\n", 37,LDBL_MIN);
  printf("The largest long double value use %cLe is: %e\n", 37,LDBL_MAX);
  printf("The largest long double value use %cLe is: %f\n", 37,LDBL_MAX);
  printf("The largest long double value use %cLe is: %g\n\n", 37,LDBL_MAX);
  getch();
}

0 komentar: