Explain integer constant .write the types of integer constants in c++
Answers
Answered by
1
Hey!!!
Here is your answer _____________
Numeric Constant
These have numeric value having combination of sequence of digits i.e. from 0-9 as alone digit or combination of 0-9 with or without decimal point (precision value) having positive or negative sign.
These are further sub-divided into two categories as:
(i) Integer Numeric Constant
(ii) Float or Real Numeric Constant
__________________________
(i) Integer Numeric Constant
An Integer Numeric Constant is a sequence of digits (combination of 0-9 digits without any decimal point or without precision), optionally preceded by a plus or minus sign.
There are 3 types of integer numeric constant namely decimal integer, octal integers and hexadecimal integer.
-----------------------------------------------
(a) Decimal Integer Numeric Constant:
These have no decimal point in it and are either be alone or be the combination of 0-9 digits. These have either +ve or -ve sign. For example: 1214, -1321, 10,254, -78, +99 etc.
-----------------------------------------------
(b) Octal Integer Numeric Constant:
These consist of combination of digits from 0-7 with positive or negative sign. It has leading with 0 or 0 (upper or lower case) means Octal or octal. For example: 0317,003, -045 etc.
--------------------------------------------------
(c) Hexadecimal Integer Numeric Constant:
These have hexadecimal data. It has leading ox, OX, Ox or x, X. These have combination of 0-9 and A-F (a-f) or alone. The letters a-f or A-F represents the numbers 10-15. For example: 0x232, 0x92, 0xACD, 0xAEF etc.
_________________________
(ii) Float or Real Numeric Constant
Float Numeric Constants consists of a fractional part in their representation; Integer constants are inadequate to represent quantities that vary continuously.
These quantities are represented by numbers containing fractional parts like 26.082.Examples of real constants are: 0.0026, -0.97, 435.29, +487.0, 3.4E-2, 4.5E5A floating-point constant consists of a sequence of decimal digits, a decimal point, and another sequence of decimal digits.
A minus sign can precede the value to denote a negative value. Either the sequence of digits before the decimal point or after the decimal point can be omitted, but not both.
Float Numeric constants are further divided into two parts. One is Mantissa Part and the other is Exponent Part.
------------------------------------------------
(a) Mantissa part:
The part without E and having a decimal point is called Mantissa Real part.
------------------------------------------------
(b) Exponent part:
The exponent part has an E within it. It is also called a scientific notation. Here E has base value 10. it computes the power.
___________________________
Hope this answer will help u....
Here is your answer _____________
Numeric Constant
These have numeric value having combination of sequence of digits i.e. from 0-9 as alone digit or combination of 0-9 with or without decimal point (precision value) having positive or negative sign.
These are further sub-divided into two categories as:
(i) Integer Numeric Constant
(ii) Float or Real Numeric Constant
__________________________
(i) Integer Numeric Constant
An Integer Numeric Constant is a sequence of digits (combination of 0-9 digits without any decimal point or without precision), optionally preceded by a plus or minus sign.
There are 3 types of integer numeric constant namely decimal integer, octal integers and hexadecimal integer.
-----------------------------------------------
(a) Decimal Integer Numeric Constant:
These have no decimal point in it and are either be alone or be the combination of 0-9 digits. These have either +ve or -ve sign. For example: 1214, -1321, 10,254, -78, +99 etc.
-----------------------------------------------
(b) Octal Integer Numeric Constant:
These consist of combination of digits from 0-7 with positive or negative sign. It has leading with 0 or 0 (upper or lower case) means Octal or octal. For example: 0317,003, -045 etc.
--------------------------------------------------
(c) Hexadecimal Integer Numeric Constant:
These have hexadecimal data. It has leading ox, OX, Ox or x, X. These have combination of 0-9 and A-F (a-f) or alone. The letters a-f or A-F represents the numbers 10-15. For example: 0x232, 0x92, 0xACD, 0xAEF etc.
_________________________
(ii) Float or Real Numeric Constant
Float Numeric Constants consists of a fractional part in their representation; Integer constants are inadequate to represent quantities that vary continuously.
These quantities are represented by numbers containing fractional parts like 26.082.Examples of real constants are: 0.0026, -0.97, 435.29, +487.0, 3.4E-2, 4.5E5A floating-point constant consists of a sequence of decimal digits, a decimal point, and another sequence of decimal digits.
A minus sign can precede the value to denote a negative value. Either the sequence of digits before the decimal point or after the decimal point can be omitted, but not both.
Float Numeric constants are further divided into two parts. One is Mantissa Part and the other is Exponent Part.
------------------------------------------------
(a) Mantissa part:
The part without E and having a decimal point is called Mantissa Real part.
------------------------------------------------
(b) Exponent part:
The exponent part has an E within it. It is also called a scientific notation. Here E has base value 10. it computes the power.
___________________________
Hope this answer will help u....
Similar questions