Wednesday, 13 June 2012

BASIC ELEMENTS IN PROGRAMMING : Control Structures

Control structure is a structure of statements in programming that allows the programmer to control the flow of a program.

Control structure can be divided into sequence, selection and repetition control structures.


SEQUENCE CONTROL




Sequence control refers to the linear execution of codes within a program. In sequence control, the statements are executed one by one in consecutive order.
In sequence control, the statements are executed one by one in consecutive order.




SELECTION CONTROL

There are times when you want your program to make a decision based on the situation given.
For example, a program that stores student’s marks may respond differently to different marks.
Or maybe a simple mathematical program will display its result as odd or even, based on the result.
Selection control enables the programmer to assign different events for different situations.
An example of selection control is “If...Then...Else” statement. The basic pseudo code for “If...Then...Else” statement is as follows.


DIFFERENTIATE BETWEEN SELECTION CONTROL AND SEQUENCE CONTROL

0 comments:

Post a Comment