# Development of Algorithm & Flowcharts

Development of Algorithm & Flowcharts is first step towards learning programming language. Generally you need to develop algorithm/flowchart of some process with step by step procedure. Let’s start!

The main purpose of using an algorithm is to illustrate the flow of data and problem solution logic.

__What is Algorithm?__

An algorithm is a finite sequence of well-defined steps or operations for solving a problem in a systematic manner. In another words we can say that an algorithm is a step-by-step problem-solving procedure.

An algorithm generally takes some input, carries out a number of effective steps in a finite amount of time, and produces some output.

**Rules for writing Algorithm
**Each instruction should be precise and unambiguous.

Each instruction should be executed in a finite time.

One or more instructions should not be repeated infinitely.

After executing the instructions, the desired results are obtained.

**Algorithm Example 1: Write an algorithm to add two nos.**

Step1: start

Step2: Read a, b

Step3: sum = a + b

Step4: write sum

Step5: stop

**What is Flow chart?**

It is a graphical representation of a program flow or an algorithm of a problem to be solved by a computer.

It is an aid to solve a complex problem easily and efficiently. It shows the detailed view of a program flow.

**Rules for drawing flowchart:**

- Use common statements that are easy to understand for words within flowchart symbols.
- Be consistent in using names and variables in the flowchart.
- Go from left to right and top to bottom in constructing flowcharts.
- Keep the flowchart as simple as possible.
- If a new flow charting page is needed, break the flowchart at an input or output point. Use properly labeled connectors to link the flowchart on different pages.

**Advantages of drawing a flowchart:**

- It helps a programmer to get a good visual reference of the structure of a program.
- It not only serves as program documentation but also helps as a means to communicate with several programmers, as it is language independent.
- It allows a programmer to test alternative solutions to a problem without even coding the program. It is much easier to find and correct logic errors prior to coding.
- It serves as a useful reference or a programming aid due to its simple and efficient method of representing the program logic of a problem.

**Algorithm Example 2 Simple Calculator:**

- Start
- Read a, b
- Compute sum = a + b
- Compute sub = a – b
- Compute mul = a * b
- Compute div = a / b
- Compute mod = a % b
- Write sum, sub, mul, div, mod

**Algorithm Example 3 Find Simple Interest:**

- Start
- Read p, r, n
- si = (p*r*n)/100
- Write si
- Stop

**Algorithm Example 4 Find volume of a circle**

1. Start

2. Read r

3. v = 4/3*(3.14)*(r*r*r)

4. Write v

5. Stop

**Algorithm Example 5 ****Calculate the amount to be paid by a customer.**

- Start
- Read cr, pr, cpu
- Compute uc = cr-pr
- Compute total_bill = uc*cpu
- Write total_bill
- Stop

** Algorithm Example 6 Check whether given no. is odd or even.**

- Start
- Read n
- Is (n%2 = = 0)? Goto step 5
- Write no is odd
- Write no is even
- Stop

**Difference between Flowchart and Algorithm**

Algorithm |
Flowchart |

An algorithm is a finite sequence of well-defined steps or operations for solving a problem in a systematic manner. | It is graphical representation of algorithm |

It is easy to write and difficult to understand than flowchart | It is difficult to draw and easy to understand than algorithm |

It does not follow strict rules | It use standard symbols for drawing. |

Hope you have understand the concept of FlowChart and Algorithm, Once you understand the complete concept, You should start with development of Program for the development of logic. In case if you have any doubts and you want to refer Algorithm and FlowChart tutorial again you can download offline version here.

PS:

If you like my article, Please share with your friends on Facebook, WhatsApp, Twitter, etc. Thanks in Advance.