Examples of Algorithm and Flowchart

Sum of Two Numbers

Algorithm

STEP 1: Start

STEP 2: Accept the first number a.

STEP 3: Accept the second number b.

STEP 4: Add a and b , and store in SUM.

STEP 5: Display the value of SUM.

STEP 6. Stop

Flowchart

flowchart

Greatest among Two numbers

Algorithm

STEP 1: Start

STEP 2: Read Two numbers a and b.

STEP 3: Compare a and b.

If a is greater than b then print a otherwise print b.

STEP 4: Stop

Flowchart

decision

First ten natural numbers

Algorithm

STEP 1: Start.

STEP 2: Initialize the variable count to one.

STEP 3: Display the variable count .

STEP 4: Increase variable count by one.

STEP 5: Check whether count variable exceeds 10.

If Yes, Go to Step 3, If No Go to step 6

STEP 6: Stop

Flowchart

repetition

Greatest among Three numbers

Algorithm

STEP 1: START

STEP 2: Read three numbers and store them in A , B, C

STEP 3: Is A > B

{Yes: Go to Step 6, No: Go to Step 4}

STEP 4:  Is B > C

{Yes: Print B is greatest, No: Go to Step 5}

STEP 5: Print C is greatest and Go to step 8}

STEP 6: Is A > C

{Yes: Print A is greatest, No: Go to Step 7}

STEP 7: Print C is greatest and Go to Step 8

STEP 8: Stop

Flowchart

greatest among three

Area of Circle

Algorithm

STEP 1: Start

STEP 2: Read Radius ‘r’.

STEP 3: Store 3.14 in the value of pi.

STEP 4: Find area of circle (Area = pi * r * r)

STEP 5: Display Area.

STEP 6: Stop

Flowchart

Area of Circle

Simple Interest

Algorithm

STEP 1: Start

STEP 2 : Read Principal, Time and Rate (P , T, R)

STEP 3: Calculate the Simple Interest (SI = P * T * R / 100)

STEP 4 : Display SI

STEP 5 : Stop

Flowchart

simple interest

Print the table of a given number N up to ten terms.

Algorithm

STEP 1: Start

STEP 2: COUNT = 0

STEP 3: Read the value of number in N

STEP 4: COUNT = COUNT + 1

STEP 5: Compute N * COUNT ;

STEP 6: Is count < = 10

{Yes: GO TO STEP 4,  No: GO TO STEP 7}

STEP 7: STOP

Flowchart

N upto ten times

Sum of first 50 natural numbers

Flowchart

sum of first 50 natural

Positive,  Negative or Zero

positive, negative or zero

Even or Odd

Even or Odd

Print 1 to 10

1 to 10

Print 10 to 1

10 to 1