Sie sind auf Seite 1von 5

Introduction about Algorithms and Flowchart

Algorithms and flowcharts are two tools a software developer uses when
creating new programs. An algorithm is a step-by-step recipe for processing
data. For example it could be a process an online store uses to calculate
discounts. A flowchart graphically represents the steps a program or set of
programs takes to process data. Though flowcharts are technically-oriented,
non-technical users can easily follow them, making them useful documents for
project management and auditing.

Algorithms

Algorithm is defined as a sequence of activities to be processed for getting


desired output from a given input.

Example of an Algorithm : Sum of the two numbers.

Algorithm:
Step1: Start
Step2: Read\input the first num1.
Step3: Read\input the second num2.
Step4: Sum num1+num2 // calculation of sum
Step5: Print Sum
Step6: End

Flowchart

The flowchart is a diagram which visually presents the flow of data through
processing systems. A flow chart is a blueprint of a design that shows the
operations performed and the sequence of these operations in a system.

Example of a Flowchart : Sum of two numbers


Features of an algorithm

1) Finiteness: An algorithm must always terminate after a finite number of


steps. It means after every step one reach closer to solution of the problem
and after a finite number of steps algorithm reaches to an end point.

2) Definiteness: Each step of an algorithm must be precisely defined. It is done


by well thought actions to be performed at each step of the algorithm.

3) Input: Any operation that is performed need some beginning


value/quantities associated with different activities in the operation. So the
value/quantities are given to the algorithm before it begins.

4) Output: One always expects output/result (expected value/quantities) in


terms of output from an algorithm. The result may be obtained at different
stages of the algorithm.

5) Effectiveness: Algorithms to be developed/written using basic operations so


that even they can in principle be done exactly and in a finite amount of time
by a person, by using paper and pencil only.

Features of Flowchart:

Refer to book
Flowchart Symbols
There are 5 basic symbols commonly used in flowcharting of assembly
language Programs: Terminal, Process, input/output, Decision and arrows.

Algorithm for 8a
Step 1: Start

Step 2: Read the price for pencils P

Step 3: Read the price of each Eraser E & no of Erasers nE

Step 4: Read the Price of a ruler R and no of rulers nR

Step 5: Read the price of a Chart paper C & no of Chart papers nC

Step 6: Calculate the Total Amount TA = P + nE x E + nR x R + nC x C


Step 7: Display the total amount
Step 8: Stop

Flow Chart :
START

Read the
Price of
Pencil P

Read the
Price of a
Eraser E and
no. of
Erasers nE

Read the Price


of a Ruler R and
no. of Rulers nR

Read the Price


of a Chart Paper
C and no. of
Chart Papers nC

Total Amount
TA = P + nE x E +
nR x R + nC x C

Display
Total
Amount

STOP
Algorithm 8b
Step1: Start
Step 2: Read the no of packets N & no. of Chocolates in each Packet C
Step 3: Read the no of Students S
Step 3: Calculate the no of Chocolates each Student gets nC = ( N X C ) / S
Step 6: Display the no of Chocolates each classmate would get nC
Step 7: Stop

Flow Chart :

START

Read the no
of packets N
& no. of
Chocolates in
each Packet
C

Read the no
of Students S

No. of Chocolates
nC = ( N X C ) / S

Display no
of
chocolates
nC

STOP

Das könnte Ihnen auch gefallen