Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Flowchart. 2 Flowchart: It is a diagram consists of symbolic block that represents the algorithm step by step Symbols of flowchart: 1. Terminal (start,

Similar presentations


Presentation on theme: "1 Flowchart. 2 Flowchart: It is a diagram consists of symbolic block that represents the algorithm step by step Symbols of flowchart: 1. Terminal (start,"— Presentation transcript:

1 1 Flowchart

2 2 Flowchart: It is a diagram consists of symbolic block that represents the algorithm step by step Symbols of flowchart: 1. Terminal (start, stop) 2. Input / output 3. Processing 4. Flow: concerned with direction 5. Decision: for logic comparison 6. Connector 7. Off-page connector

3 3 Flowchart: Ex: draw the flowchart for this algorithm: 1. Begin 2. startstopRead name, markprint name, new_markNew_mark = mark+5 3. input name, mark 4. new_mark = mark+5 5. print name, new_mark 6. End start stop Read name, mark print name, new_mar k New_mark = mark+5

4 4 Flowchart: Ex: draw the flowchart for this algorithm: 1. Begin 2. studentcount =1 3. if studentcount > 10 then Stop else  read name, mark  calculate new_mark = mark + 5  print name, new_mark  studentcount = studentcount +1  goto step 3 start stop print name, new_mark studentcount =1 new_mark = mark + 5 studentcount = studentcount +1 A A studentc ou nt <= 10 Read name, mark

5 5 Flowchart: Ex: Draw a flowchart to compute: F = x 2 –y + x L<0 2x + y L=0 (x / y) + 10 L>0 1. start 2. read x, y, L 3. if (L<0) then F = x 2 –y + x else if (L=0) then F = 2x + y else F = (x / y) + 10 4. write F 5. stop start Write F x 2 –y + x L=0 stop Read x, y, L (x / y) + 10 L< 0 2x + y yes No

6 6 Flowchart: Ex: Trace the following flowchart to find the value of max and min variable for 4 numbers order as follows (x = 4, 2, 1, 3)? start Read n Max=x Min=x b stop I = I +1 I<=n Read x Read n I = 2 A A Maxx b Max = x Min = x yes No yes

7 7 Flowchart: Ex: Read name for student, when name="xxx" stop the program, if name does not equal "xxx" then compute the grade of every student. Every student has five courses. The average for the student courses has to be computed and there by the grade is given. Avg > = 90 ------------------------> grade = 'A' 80 grade = 'B' 70 grade = 'C' 60 grade = 'D' Avg grade = 'F'

8 8 Sol: 1. Start 2. read name 3. while (name != "xxx") do 1. begin 2. total = 0 3. for count = 0 to 5 do 1. begin 2. read mark 3. total = total + mark 4. end 4. avg = total / 5 5. if ( avg >= 90) then grade = 'A' else if ((avg >=80) and (avg < 90)) then grade = 'B' else if ((avg >=70) and (avg < 80)) then grade = 'C' else if ((avg >=60) and (avg < 70)) then grade = 'D' else Grade = 'F' 1. Write name, grade 2. read name 3. end 4. stop

9 9 start Read name total= 0 Count= 0 Name = "xxx" B A stop yes No A Read mark total= total + mark count= count + 1 count < 5 yes No avg = total / 5 avg > = 90 ((avg >=80) and (avg < 90)) ((avg >=70) and (avg < 80) ((avg >=60) and (avg < 70)) B Write name, grade C C Grade='A' Grade='B' Grade='C' Grade='D' Grade='F' yes No


Download ppt "1 Flowchart. 2 Flowchart: It is a diagram consists of symbolic block that represents the algorithm step by step Symbols of flowchart: 1. Terminal (start,"

Similar presentations


Ads by Google