Computer Science, asked by deepchandak7, 1 year ago

What is real constant

Answers

Answered by Poiuytrew02
4

Real or Floating-point constant

Constants in C are fixed value that does not change during the execution of a program. A real constant is combination of a whole number followed by a decimal point and the fractional part. Example: 0.0083 -0.75 .95 215.

Use of Real or Floating-point constants

Integer numbers are inadequate to represent quantities that vary continuously, such as distances, heights, temperatures, prices and so on. These quantities are represented by numbers containing fractional part. Such numbers are called real or floating point constants.

The Real or Floating-point constants can be written in two forms:

1. Fractional or Normal form

2. Exponential or Scientific form

Express a Real constant in fractional form

A real constant consists for a series of digits representing the whole part of the number, followed by a decimal point, followed by a series of representing the fractional part. The whole part or the fractional part can be omitted, but both cannot be omitted. The decimal cannot be omitted. That is, it is possible that the number may not have digits before the decimal point or after the decimal point.

Valid Real constants (Fractional): 0.0 -0.1 +123.456 .2 2.

Invalid Real constant: - 1 - a decimal point is missing

1, 2.3 - Illegal character (.)

Rules for Constructing Real Constants in Fractional Form

1. A real constant must have at least one digit.

2. It must have a decimal point.

3. It could be either positive or negative.

4. Default sign is positive.

5. Commas or blanks are not allowed within a real constant.

Express a real constant in Exponential form

A real constant is combination of a whole number followed by a decimal point and the fractional part. If the value of a constant is either too small or too large, exponential form of representation of real constants is usually used.

In exponential form, the real constant is represented in two parts.

Mantissa - The part appearing before e, the mantissa is either a real number expressed in decimal notation or an integer.

Exponent - The part following e, the exponent is an integer with an optional plus or minus sign followed by a series of digits. The letter e separating the mantissa and the exponent can be written in either lowercase or uppercase.

Example: 0.000342 can be represented in exponential form as 3.42e-4

7500000000 can be represented in exponential form as 7.5e9 or 75E8

Rules for Constructing Real Constants in Exponential Form

1. The mantissa part and the exponential part should be separated by letter in exponential form

2. The mantissa part may have a positive or negative sign.

3. Default sign of mantissa part is positive.

4. The exponent part must have at least one digit, which must be a positive or negative integer. Default sign is positive.

5. Range of real constants expressed in exponential for is -3.4e38 to 3.4e38.


deepchandak7: What is a varuable
deepchandak7: What is variable
jatinkumar29: variable is alphabets in computer
Answered by jatinkumar29
2

Answer:

real constant is that things etc who doesn't change places

Similar questions
Math, 1 year ago