Presentation is loading. Please wait.

Presentation is loading. Please wait.

Representing an algorithm using Flowcharts. Flowcharts Many of us find it easier to follow steps when they are represented diagrammatically or graphically.

Similar presentations


Presentation on theme: "Representing an algorithm using Flowcharts. Flowcharts Many of us find it easier to follow steps when they are represented diagrammatically or graphically."— Presentation transcript:

1 Representing an algorithm using Flowcharts

2 Flowcharts Many of us find it easier to follow steps when they are represented diagrammatically or graphically. Flowchart shapes are: terminators symbol(start or stop) process symbol(assignments, calculations) input/output symbols (read, write) decision symbol(decisions between 2 options) flow control- flow of steps connector symbol(used to connect sections of a flowchart

3 Flowchart algorithm1 Write a pseudocode algorithm and a flowchart to find and display the sum of 10 and 20 Start a  10 b  20 Sum  a + b Print Sum stop start a  10 b  20 sum  a + b Print sum stop

4 Flowchart algorithm2 Draw a flowchart that will read 3 numbers and find the product of the 3 numbers Start Read n1, n2, n3 Product  n1*n2*n3 Display product stop start Read n1,n2,n3 Product  n1*n2*n3 Print product stop

5 Flowchart algorithm3 Draw a flowchart that will accept 3 numbers and find and display their average Start Read n1,n2,n3 Average  (n1+n2+n3)/3 Write average stop start Read n1,n2,n3 Average  (n1+n2+n3)/3 Write average stop

6 Flowchart algorithm4 Draw a flowchart that will prompt the user to enter 2 unequal numbers and find the largest between them. Start Write “Enter 2 unequal numbers” Read n1,n2 If n1>n2 then set large  n1 else set large  n2 Endif Print large stop start Write “Enter 2 unequal numbers” Read n1,n2 Is n1>n2 Large  n1Large  n2 Write large stop yesno

7 Flowchart algorithm4 Draw a flowchart that will prompt the user to enter 3 unequal numbers and find the smallest among them. Start Write “Enter 3 unequal numbers” Read num1,num2,num3 If num1

8 start Write “enter 3 unequal numbers Read num1,num2,num3 Is num1

9 Question A problem requires you to read 3 numbers and calculate and print the total. Construct: – IPO chart – Pseudocode – Flowchart


Download ppt "Representing an algorithm using Flowcharts. Flowcharts Many of us find it easier to follow steps when they are represented diagrammatically or graphically."

Similar presentations


Ads by Google