Algorithm and flowchart
Transcript of Algorithm and flowchart
![Page 1: Algorithm and flowchart](https://reader036.fdocuments.us/reader036/viewer/2022062503/58ecc7561a28abe0488b4621/html5/thumbnails/1.jpg)
1
Algorithm and Flowchart
Presented by: The AnonymousBSc.CSIT 1st semester
![Page 2: Algorithm and flowchart](https://reader036.fdocuments.us/reader036/viewer/2022062503/58ecc7561a28abe0488b4621/html5/thumbnails/2.jpg)
ContentWhat is algorithm ?Properties of algorithmWhat is flowchart ?Merits of flowchartDemerits of flowchartAlgorithm and Flowchart in CodingReferencesQueries
2
![Page 3: Algorithm and flowchart](https://reader036.fdocuments.us/reader036/viewer/2022062503/58ecc7561a28abe0488b4621/html5/thumbnails/3.jpg)
3
What is an algorithm ?
Named after Persian mathematician Mohammad Al-Khwarizmi
A sequential solution of any problemWritten in human understandable formRequires a clear understanding of the problem
![Page 4: Algorithm and flowchart](https://reader036.fdocuments.us/reader036/viewer/2022062503/58ecc7561a28abe0488b4621/html5/thumbnails/4.jpg)
4
Example:1. Algorithm for sum of two numbers
Step 1: StartStep 2: Enter two numbers in a and bStep 3: Add a and b and store in cStep 4: Display cStep 5: End
![Page 5: Algorithm and flowchart](https://reader036.fdocuments.us/reader036/viewer/2022062503/58ecc7561a28abe0488b4621/html5/thumbnails/5.jpg)
5
2. Algorithm to check whether the input number is even or odd
Step 1: StartStep 2: Enter a number in aStep 3: Check if it is even or odd Step 4: If even print “even” (a mod 2 = 0 )Step 5: Else print “odd”Step 6: End
![Page 6: Algorithm and flowchart](https://reader036.fdocuments.us/reader036/viewer/2022062503/58ecc7561a28abe0488b4621/html5/thumbnails/6.jpg)
6
Properties of algorithm
FinitenessProperly definedInputOutputEffectivenessIndependent to any other programming language
![Page 7: Algorithm and flowchart](https://reader036.fdocuments.us/reader036/viewer/2022062503/58ecc7561a28abe0488b4621/html5/thumbnails/7.jpg)
7
Now moving on to next programming
tool
![Page 8: Algorithm and flowchart](https://reader036.fdocuments.us/reader036/viewer/2022062503/58ecc7561a28abe0488b4621/html5/thumbnails/8.jpg)
8
What is flowchart?
Diagrammatic representation of algorithmAn important programming toolSolving a problem using figuresDifferent figures having different functions
![Page 9: Algorithm and flowchart](https://reader036.fdocuments.us/reader036/viewer/2022062503/58ecc7561a28abe0488b4621/html5/thumbnails/9.jpg)
9
Merits of flowchart
•Easy to explain program logic•Makes coding effective and faster•Effective communication•Different symbols used•Serve as documentation•Easy to detect, locate and remove bugs in a program
![Page 10: Algorithm and flowchart](https://reader036.fdocuments.us/reader036/viewer/2022062503/58ecc7561a28abe0488b4621/html5/thumbnails/10.jpg)
10
Demerits of FlowchartTime consuming and monotonous jobDifficult to maintainOccupies space while documentationTranslation to computer program is difficult
![Page 11: Algorithm and flowchart](https://reader036.fdocuments.us/reader036/viewer/2022062503/58ecc7561a28abe0488b4621/html5/thumbnails/11.jpg)
11
But what might be the symbols used in flowchart?
![Page 12: Algorithm and flowchart](https://reader036.fdocuments.us/reader036/viewer/2022062503/58ecc7561a28abe0488b4621/html5/thumbnails/12.jpg)
12
Flowchart symbolsSymbol Function Description
Start/End Start and end point
Input/output Input and output operations
Processing operation Editing and calculation of data
Decision Check logical condition
Connector Indicates logical flow from one page to another
Direction of logic Direction of flow of logic
Comment Indicates any comments for explanatory notes
![Page 13: Algorithm and flowchart](https://reader036.fdocuments.us/reader036/viewer/2022062503/58ecc7561a28abe0488b4621/html5/thumbnails/13.jpg)
13
Example 1: Flowchart add sum of two numbersSTART
Input a and b
C = a + b
Display c
END
User can enter any two numbers
![Page 14: Algorithm and flowchart](https://reader036.fdocuments.us/reader036/viewer/2022062503/58ecc7561a28abe0488b4621/html5/thumbnails/14.jpg)
14
Example 2: Flowchart to check whether the input number is even or odd
START
Accept a number
Divide it by 2
END
Is remainder = 0 ?
Display odd Display even
YesNo
START
Accept a number
![Page 15: Algorithm and flowchart](https://reader036.fdocuments.us/reader036/viewer/2022062503/58ecc7561a28abe0488b4621/html5/thumbnails/15.jpg)
15
Using Algorithm and Flowchart in CodingCoding
Enter numbers in a and b: 56Displayed c: 11
![Page 16: Algorithm and flowchart](https://reader036.fdocuments.us/reader036/viewer/2022062503/58ecc7561a28abe0488b4621/html5/thumbnails/16.jpg)
16
References:Websites:
google.comwikipedia.comlinkedin.com
External sources:Text book: Fundamentals of computer programming
![Page 17: Algorithm and flowchart](https://reader036.fdocuments.us/reader036/viewer/2022062503/58ecc7561a28abe0488b4621/html5/thumbnails/17.jpg)
17
Queries