Double Data Type In C++ With Example

Card image cap

Double Data Type ?

Double data type is used for stores fractional numbers, containing one or more decimals. Sufficient for storing 15 decimal digits values or decimal values.


Double data type :

Double data type is used for stores fractional numbers, containing one or more decimals. Sufficient for storing 15 decimal digits values or decimal values.

A double type can represent fractional as well as whole values.

Syntax:

  double Value1;
  double Value2 = 1.5;
Card image cap

Example 1:



Output :

    19.99
Card image cap

Example 2:



Output :

	Size of char : 1 byte
	Size of int : 4 bytes
	Size of short int : 2 bytes
	Size of long int : 8 bytes
	Size of signed long int : 8 bytes
	Size of unsigned long int : 8 bytes
	Size of float : 4 bytes
	Size of double : 8 bytes
	Size of wchar_t : 4 bytes
Card image cap