0% found this document useful (0 votes)
2 views7 pages

1 Algorithm Flowchart

The document explains algorithms, flowcharts, and pseudocode, emphasizing the characteristics and key features of algorithms such as sequence, decision, and repetition. It provides examples of algorithms for adding two numbers, checking equality, and summing the first ten natural numbers. Additionally, it describes flowcharts as graphical representations of processes, detailing the symbols used in flowchart creation.

Uploaded by

aasthakg300
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views7 pages

1 Algorithm Flowchart

The document explains algorithms, flowcharts, and pseudocode, emphasizing the characteristics and key features of algorithms such as sequence, decision, and repetition. It provides examples of algorithms for adding two numbers, checking equality, and summing the first ten natural numbers. Additionally, it describes flowcharts as graphical representations of processes, detailing the symbols used in flowchart creation.

Uploaded by

aasthakg300
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ALGORITHM, FLOWCHART and PSEUDOCODE

Algorithm: An algorithm provides a blueprint to writing a program to solve a particular


problem. It is considered to be an effective procedure for solving a problem in a finite number of
steps.
So the algorithm gives a step by step description of how to arrive at a solution.

An algorithm should qualify the following characteristics:


i) Be precise
ii) Be unambiguous
iii) Not even a single instruction must be repeated infinitely.
iv) After the algorithm gets terminated, the desired result must be obtained.
Key features of Algorithms:
i) Sequence
ii) Decision
iii) Repetition
i) Sequence : Sequence means that each step of the algorithm is executed in the specified
order.

Example: Want to add two numbers

Step1 : Input the first number as A


Step 2: Input the second number as B
Step 3 : Set Sum=A + B
Step 4: Print Sum
Step 5: End

ii) Decision : Decision statements are used when the outcome of the process depends on
some conditions.

if x = y then we print “Equal”


General statement:
if condition then process

Also, we can write,


if condition
then process1
else process2

Example: Check X=Y or not. If equal print “EQUAL” , otherwise print “NOT
EQUAL”

Step 1: Input the first number as X


Step 2; Input the second number as Y
Step 3: if X = Y
then print “EQUAL”
else
print “NOT EQUAL”
Step 4: End
iii) Repetition: Repetition involves executing one or more steps for a number of times.
This can be implemented using constructs such as, while, do-while and for loops.

Example: Write an algo to find the sum of first 10 natural numbers.

Step 1: Set I = 1, sum = 0


Step 2: Repeat Step 2 and 3 while I<=10
Step 3: Set sum = sum + I (sum =3 + 3 = 6)
Set I = I + 1 (I=2+1=3)
Step 4: print sum
Step 5: End

/************ OR **********/

Step 1: Set I = 1, sum = 0


Step 2: Repeat while I<=10
Set sum = sum + I
Set I = I + 1
Step 3: print sum
Step 4: End

Flowchart : A flowchart is a graphical or symbolic representation of a process.


The symbols are:
1. Start and end symbols

2. Arrows

3. Generic processing steps


4. Input/output symbol

5. A conditional or decision symbol

6. Labelled connectors
Flowchart:
Example: Draw a flowchart to calculate the sum of the first 10 natural numbers.

START

Set I =1 and
Set SUM = 0

Set SUM = SUM + I


Set I = I + 1

NO
Is I=10?

YES

Display SUM

END

You might also like