Presentation is loading. Please wait.

Presentation is loading. Please wait.

Flowchart.

Similar presentations


Presentation on theme: "Flowchart."— Presentation transcript:

1 Flowchart

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

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

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

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

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 I = 2 A Max<x Min>x Max = x Min = x yes No

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 > = > grade = 'A' 80 < =Avg < > grade = 'B' 70 < =Avg < > grade = 'C' 60 < =Avg < > grade = 'D' Avg < > grade = 'F'

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

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


Download ppt "Flowchart."

Similar presentations


Ads by Google