Numerical Constants (a) Integer Constants: These constants are represented with whole numbers. They require a minimum of
Question:
Numerical Constants
(a) Integer Constants: These constants are represented with whole numbers. They require a
minimum of 2 bytes and a maximum of 4 bytes of memory.
The following concepts are essential to follow the numerical constants:
(a) Numerical constants are represented with numbers. At least one digit is needed for
representing the number.
(b) The decimal point, fractional part, or symbols are not permitted. Neither blank spaces nor
commas are permitted.
(c) Integer constant could be either positive or negative or may be zero.
(d) A number without a sign is assumed as positive.
Some valid examples: 10, 20, +30, -15, etc.
Some invalid integer constants: 2.3, .235, $76, 3 ^6, etc.
Besides representing the integers in decimal, they can also be represented in octal or hexadecimal number system based on the requirement.
Octal number system has base 8 and the hexadecimal number system has base 16. The octal
numbers are 0, 1, 2, 3, 4, 5, 6, and 7 and the hexadecimal numbers are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
A, B, C, D, E, and F.
The representation of octal numbers in C would be done with leading digit 0 and for hex representation, with leading OX or OX.
Examples of octal and hexadecimal numbers:
Octal numbers - 027, 037, 072
Hexadecimal numbers - 0X9, 0Xab, 0X4
(b) Real Constants: Real constants are often known as floating point constants. Real constants
can be represented in exponential or fractional form. Integer constants are unfit to represent
many quantities. Many parameters or quantities are defined not only in integers but also in real
numbers. For example, length, height, price, distance, etc. are also measured in real numbers.
The following concepts are essential to follow the real numbers:
(a) The decimal point is permitted.
(b) Neither blank spaces nor commas are permitted.
(c) Real numbers could be either positive or negative.
(d) The number without a sign is assumed as positive.
Examples of real numbers are 2.5, 5.521, 3.14, etc.
The real constants can be written in exponential notation, which contains fractional and exponential parts. For example, the value 2456.123 can be written as 2.4561 X e+
3.
The part that precedes e is called mantissa and the part that Age: 20
Height: 5.4
Sex: M
2.8 Variables
Variables are the basic objects manipulated in a program. Declaration gives an introduction of variable
to compiler and its properties like scope, range of values and memory required for storage. A variable
is used to store values. It has memory location and can store single value at a time.
When a program is executed, many operations are carried out on the data. The data types are
integers, real or character constants. The data is stored in the memory, and at the time of execution it
is fetched for carrying out different operations on it.
A variable is a data name used for storing a data value. Its value may be changed during the program execution. The variable value keeps on changing during the execution of the program. In other
words, a variable can be assigned different values at different times during the program execution.
A variable name may be declared based on the meaning of the operation. Variable names are made up
of letters and digits. Some meaningful variable names are as follows.
Bank Management and Financial Services
ISBN: 978-0078034671
9th edition
Authors: Peter Rose, Sylvia Hudgins