Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lesson 2 Flowcharting.

Similar presentations


Presentation on theme: "Lesson 2 Flowcharting."β€” Presentation transcript:

1 Lesson 2 Flowcharting

2 Software Development Process
1. Problem Solving Identify Inputs, Output and required processing from the problem statement. Prepare an algorithm for solving the problem. 2. Implementation Implement the algorithm using a Programming language.

3 Calculate the area of Circle if the diameter of Circle is given.
EXAMPLE Problem Statement: Calculate the area of Circle if the diameter of Circle is given.

4

5 Algorithm Algorithm refers to the steps required to perform a specific task. The word algorithm is derived from algebra and to recognize the work of Muslim mathematician Muhammad bin Musa Al Khwarizmi. The algorithm requires certain inputs, which are processed in specific way in the algorithm steps and specific output is generated by the algorithm.

6 Flowchart Flowchart is a diagrammatic representation of algorithm, which is easily understandable as "A Picture is worth a thousand words". There are specific symbols used in flowcharts for specific purpose. These are used by the programmers to understand the design and later convert it to a computer program.

7 Flowchart Symbols

8 Basic Guidelines for drawing Flowcharts:
Before drawing a flowchart, it is better to do the following tasks. The direction of flow of flowchart should be from left to right or top to bottom. Only one flow line should Enter/Exit from a process. Only one flow line should Enter a decision symbol, but two flow lines, one for each possible answer (Yes and NO), should Exit from decision symbol. Only one flow line will exit from Start and 1 will enter in End of algorithm. Β  Multiple flows can be joined to 1 flow using Connector symbol It is useful to test the validity of the flowchart by passing through it with a simple test data.

9

10 Pseudo code It is a text based representation of algorithm. Pseudo code doesn't have some fixed format like the programming languages because this is only to help the programmers to understand the design and later it is converted it to a computer program.

11 Pseudo code: 1. Input diameter 2. radius = diameter / 2 3. area = 3.14 x (radius x radius) 4. Output area

12 Problem 1: Write Pseudo code and draw flowchart for finding the average of two numbers
Input: two numbers x and y Output: the average of x and y

13

14 Pseudo code: Steps: 1. input x 2. input y 3. sum = x + y 4. average = sum /2 5. output average

15 Problem No.2: Write Pseudo code and draw flowchart to compute the area (A) and circumference (C) of a circle

16 Input: radius (R) Output: area (A), circumference (C)

17 START Input R A = PI x R x R C = 2 x PI x R Output A and C END PI = 3.14

18 Pseudo code: Steps: 1. Input R 2. PI = 3.14 2. 𝐴=𝑃𝐼×𝑅×𝑅 3. 𝐢 = 2 Γ— 𝑃𝐼 ×𝑅 4. Output A and C

19 Problem 3: Write Pseudo code and draw flowchart to compute a maximum of two numbers

20 Input: two numbers N1 and N2
Output: the Max number

21 START Input N1 and N2 Max=N1 Output max END N1>N2 Max=N2 No Yes

22 Pseudo code: Steps: 1. Input N1,N2 2. if N1 > N2 go to step 3,otherwise go to step 4 3. Max=N1, go to step 5 4. Max=N2 5. Output Max

23 Problem 4: Write an algorithm to print Even numbers from 1 to 50.

24 Input: Not required Output: Even numbers from 1- 50

25 Yes No START Counter = 2 Counter=Counter+2 Output Counter
END Counter = 2

26 Pseudo code: Steps: 1. Counter = 2 2. Repeat Steps 3 and 4 While Counter <= 50 3. Output Counter 4. Counter = Counter+2


Download ppt "Lesson 2 Flowcharting."

Similar presentations


Ads by Google