Tuesday, September 3, 2013

PSEUDO-CODES IN PROGRAMMING

WHAT ARE PSEUDO-CODES ?

The pseudo- code is step by step representation written in plain english of an algorithm, which can be perceived as the initial stage of formal coding. Instead of directly digging upon the proper code, it is preferred to write pseudocode to get an essence of the logic applied in the algorithm.

Some of the conventions, keywords etc. followed while writing a pseudo-code are as follows :
1. 'input' keyword is used to take the input from the user.
2. 'display' keyword is used to show the result.
3. Mathematical expressions are used as we do normally.
4. For decision making constructs, 'if' , 'then', 'else' , 'else if' keywords are used.
5. When some statements are to be repeated for a known number of times, 'for', 'to', 'do', 'end for' keywords are used.
6. When some statements are to be repeated as long as some condition remains true then , 'while', 'end while' keywords are used.


TYPES OF PSEUDO-CODES

1. SEQUENTIAL PATTERN ( the statements are executed in the same order as it is written)

2. SELECTIONAL PATTERN ( they involve decision making situations )

3. ITERATIONAL PATTERN ( they involve repitition of the statements )


No comments:

Post a Comment