In a Sequence Structure or sequential structure, the statements of a Program are executed in the same order in which they are written in the program. The statements are executed one after the other. In this structure, all statements of the program executed sequentially without skipping any Statement.
An algorithm with sequence structure are as follows:
In the above diagram, the first statement is "Statement-1" and "Statement-n" is the last statement that will be executed in a sequence from top to bottom (such as from statement-1 to statement-n).
Example Program of C++ Sequence Structure:
The following source code of the program execute statement one by other and displays result on the screen.
#include
#include
main()
{
cout
cout
cout
cout
getch();
}//end main function
If you run this program, the output will be as follows: