Algorithm in Programming


Solutions Algorithm in Programming Logic Design

An algorithm is a step by step procedure to solve a problem. The process of solving a problem becomes simpler and easier with the help of algorithm. It is better to write algorithm before writing the actual program.

Properties of Algorithm

Following are some properties of an algorithm:
  • The given problem should be broken down into simple and meaningful steps.
  • The steps should be numbered sequentially.
  • The steps should be descriptive and written in simple English.

Algorithms are written in a language that is similar to simple English called pseudo code. There is not standard to write pseudo code. It is used to specify program logic in an English like manner that is independent of any particular programming language.

Pseudo code simplifies program development by separating it into two main parts.
  1. Logic Design
  2. Coding

1- Logic Design

In this part, the logic of the program is designed. We specify different steps required to solve the problem and the sequence of these steps.

2- Coding

In this part, the algorithm is converted into a program. The steps of algorithm are translated into instructions of any programming language. The use of pseudo code allows the programmer to focus on the planning of the program. After the planning is final, it can be written in any programming language.

Example

The following algorithm inputs two number, calculates sum and then displays the result on screen.
  1. Start
  2. Input A
  3. Input B
  4. Total = A + B
  5. Display Total
  6. Exit
Solutions Logic Design Chapter Next »