# Pseudo Codes for Basic Logic (Control) Structure

Pseudocode is a compact and informal high-level description of a computer programming algorithm.
Pseudo-code typically omits details that are not essential for human understanding of the algorithm such as variable declaration, system-specific code and subroutines.
The purpose of using pseodocode is that it is easier for humans to understand than conventional programming language code.

Sequence Logic
Sequence logic is used for performing instruction one after another in sequence. The logic flow of pseudo code is from top to bottom.

Selection Logic
1. If-else
Selection logic also known as decision logic is used for making decision.It is also called as decision logic.
It is used for selecting the proper path out of two or more alternative paths in program logic.Selection logic is depicted as an IF.....THEN.....ELSE or on IF.....THEN or a case structure.
The IF......THEN......ELSE construct says that if condition is true then
do process-I else (if condition is not true) do process-II.

If we simply want do decide if a process is to be performed or not the IF.....THEN structure is used this structure says that if condition is true then do process-I and if it is not true then skip over process-I.

Switch-case
The case structure is multiple way selection logic structure.The CASE structure indicates that if the value of type is equal to type I execute process-I if it equal to type II executes process II if it equals to type 3 execute process 3 if so on.
Fig: Flowchart for 'CASE' selection structure

Iteration (or Looping) Logic

The looping structures in C are-
While loop
For loop
Do -while loop
Repeat-until
Iteration logic is used to produce loops in program logic when one or more instruction may be executed several times depending on some condition.
In case Do-WHILE the looping will continue as long as the condition is true the looping steps when the condition is not true.
Important : Do-while loop is useful when we want the statements within the loop must be executed at least once.
Fig: Flowchart for DO-WHILE iteration structure

In case of REPEAT.....UNTIL : The looping continues until the condition becomes true. That is the execution of the statement  within the loop is repeated as long as the condition is not true.

#### 1 comment:

1. This comment has been removed by a blog administrator.

## Categories

Android (21) AngularJS (1) Books (10) C (75) C# (4) C++ (81) Downloads (1) Engineering (13) FPL (17) Hadoop (1) HTML&CSS (38) IS (25) Java (87) Leet Code (4) PHP (20) Python (214) R (69) Software (14) SQL (27)