TOPIC 3
FUNDAMENTALS
PROGROAFMMING
LANGUAGE
Outcomes
At the end of the lecture, student will
be able to:
State data definition of data
Explain the da types: numeric and
non-numeric
Define identifier, variable, constant
and reserved word
State the naming convention rules
for identifier
DATA TYPES
Data is an array of facts that can be
modified by the computer into useful forms
for human beings.
All the variables and constants have to be
declared before they are used in the
program.
To declare the variables, we have to identify
the categories of data and name each
uniquely.
It is because once we declare the variable, a
memory space will be provided.
Data -> Numeric and Non Numeric
NUMERIC
Contains all types of
numbers
Data which can be used
for calculation.
Example: sums of money,
age, and distance (e.g: 34,
50, and 1.01)
NUMERIC
INTEGER
All positive and negative numbers
including zero and no decimal
place.
Example: 0, +1, -10.
Integers are used to represent the
counting of things.
Example: Numbers of month in a
year (1,2,3…)
NUMERIC
REAL NUMBER
Contains all real numbers.
The number will be stored in
floating point.
Used for metric measurement,
temperature and price.
Example: 1.0, 234.55, 20.30, 36.7.
NON NUMERIC
CHARACTER
Consists of all letters,
numbers and special
symbols.
Characters are surrounded by
single quotation mark (‘ ‘).
Example: ‘A’, ‘m’,’=’, ‘#’, ‘1’ or ‘ ‘.
NON NUMERIC
STRING
A combination of one or more
characters.
A string is surrounded by
double quotation marks (“ “).
Example: (“WELCOME TO
COSMOPOINT”) or (“8758”).
NON NUMERIC
LOGICAL VALUE
Used in making yes-or-no
decisions (TRUE-or-FALSE).
Example: To check 2
integers using If…Else
control structure.
EXAMPLES
DATA TYPES
TYPES OF DATA
BASIC DATA
TYPES
ACTIVITY
What is the suitable data type for the
follo
wing ?
Number of student in your
class
Your matrix number
Assignment marks for this
subject
Malaysian’s plate number
Number of people living
in malaysia