# Types Of Integer Constants.

**Q10. How many types of integer constants are allowed in C++? How are they written?**

**Ans. **C++ allows three types of integer constants:

- Decimal (base 10),
- Octal (base 8),
- Hexadecimal (base 16).

**Decimal Integer Constants:**

An integer constant consisting of a sequence of digits is taken to be decimal integer constant unless it begins with 0 (digit zero).

For instance, 1234, 41, +97, -17 are decimal integer constants.

**Octal Integer Constants:**

A sequence of digits starting with 0 (digit zero) is taken to be an octal integer.

For instance, decimal integer 8 will be written as 010 as octal integer. (… 8_{10} = 10_{8}) and decimal integer 12 will be written as 014 as octal integer (… 12_{10} = 14_{8}).

**Hexadecimal Integer Constants:**

A sequence of digits preceded by 0x or 0X is taken to be an hexadecimal integer.

For instance, decimal 12 will be written as 0XC as hexadecimal integer.