ICT Grade 9
DEVELOPING A PROGRAM….
Declaration is the process of identifying variables according to their TYPE.
Variables can be categorised as integers, character or strings, and real.
We declare variables as int- when we deal with integers.
e.g int a;
Char/string- when we deal with characters or letters of alphabets.
e.g: Char* b;/string
string b;
real – For declaring real numbers
Types for storing real numbers. 32
32-bit real number float.
64--bit real number double.
Assignment is the procedure for giving variables values.
After declaring variables, we assign (give) them values to represent them. We use = (sign) to
assign variable.
e.g int q;
q=3;
Indentation refers to the spaces at the beginning of a code line.
e.g
START
Input int a;
Input char*p;
STOP.
Note:: the space left before writing input was reserved for indentation.
Iteration is the repetition of a process in order to generate a sequence of out
For our scope of study, we are going to learn for loop, if…else statement and do…while.
For loop:
e.g for(int x=2;x<=20;x+2)
Wee can use the above for loop to count the even number ranging from 2 to 20.