Flowchart (1) .pdf



Nom original: Flowchart (1).pdfTitre: Microsoft PowerPoint - Flowchart-new [Compatibility Mode]Auteur: Sahar

Ce document au format PDF 1.3 a été généré par PrimoPDF http://www.primopdf.com / Nitro PDF PrimoPDF, et a été envoyé sur fichier-pdf.fr le 05/10/2015 à 14:19, depuis l'adresse IP 5.41.x.x. La présente page de téléchargement du fichier a été vue 558 fois.
Taille du document: 285 Ko (22 pages).
Confidentialité: fichier public


Aperçu du document


Flowchart symbols

Start / Stop

Process

Input / output

Condition

Connector

Direction Arrows

Simple Flowcharts (1)
Summation of two numbers



Example:
Draw a flowchart for a program that
sums two numbers.



Solution


Step 1 : Identify input





Read A, B

First number
Second number

Step 2 : identify output




Start

The summation of the two numbers

Step 3: Construct the algorithm





Input first number (A)
Input second number (B)
Sum A and B and store the result in
(C)
Print C

C=A+B

Print C

Stop

Simple Flowcharts (2)
Average of three numbers



Example:
Draw a flowchart for a program that
finds the average of three numbers



Solution


Step 1 : Identify input







Read A, B, C

First number
Second number
Third number

Step 2 : identify output


Start

The average of the three numbers

D = (A + B + C) / 3

Step 3: Construct the algorithm






Input first number (A)
Input second number (B)
Input Third number (C)
Sum A and B and C then divide the
result by 3 and store the result in
(D)
Print D

Print D

Stop

Simple Flowcharts (3)
Area of rectangle



Example:
Draw a flowchart for a program that
finds the area of a rectangle.



Solution


Step 1 : Identify input






Read L, W

Length of rectangle
Width of rectangle

Step 2 : identify output


Start

The area of the rectangle

A= L*W

Step 3: Construct the algorithm





Input length of rectangle (L)
Input width of rectangle (W)
Multiply L by W then store the
result in (A)
Print A

Print A

Stop

Simple Flowcharts (4)
Volume of a sphere



Example:
Draw a flowchart for a program that finds the
volume of a sphere. Note that the volume of
sphere can be computed using the following
formula :
3

V =4 rπ
3



Start

Read r

Solution
– Step 1 : Identify input
• Radius of sphere

V=4/3 * r * r * r * 3.14

– Step 2 : identify output
• The volume of the sphere

– Step 3: Construct the algorithm
• Input radius of the sphere (r)
• Compute the volume of the
sphere using the formula given
above and store the result in (V)
• Print V

Print V

Stop

Branching Flowcharts (1)
Print pass if mark >=60



Example:
Draw a flowchart for a program that
prints the word PASS if a student
mark is greater or equal to 60.

Start
Read M



Solution


Step 1 : Identify input




M>=60

Yes

Step 2 : identify output




Student mark (M)

If the student mark above or equal
to 50 the output will be PASS ,
otherwise no output will be printed.

No

Print “PASS”

Step 3: Construct the algorithm



Input student mark (M)
If M >=50 print PASS

Stop

Branching Flowcharts (2)
Print pass if mark >=60 otherwise print fail





Example:
Draw a flowchart for a program that
prints the word PASS if a student
mark is greater or equal to 60,
otherwise it should print FAIL.

Start
Read M

Solution


Step 1 : Identify input




Student mark (M)

M>=60

Yes

Step 2 : identify output




No

If the student mark above or equal
to 50 the output will be PASS ,
otherwise print FAIL.

Print “FAIL”

Print “PASS”

Step 3: Construct the algorithm



Input student mark (M)
If M >=50 print PASS otherwise
print FAIL

Stop

Branching Flowcharts (3)
Find Largest among two numbers





Example:
Draw a flowchart for a program that
takes two numbers and decides
which one of them is the greatest.
Assume the two numbers are not
the same.
Solution


Step 1 : Identify input







If the first number is greater than
the second number then the
program prints “First is greater” ,
otherwise it prints “Second is
greater”.

Step 3: Construct the algorithm



Read N1 , N2

No

N1 > N2

Yes

First number (N1)
Second Number (N2)

Step 2 : identify output


Start

Input two numbers (N1 , N2)
If N1 > N2 print First is greater
otherwise print Second is greater

Print “Second is
greater”

Print “First is greater”

Stop

Branching Flowcharts (4)
Classify weather conditions according to temperature





Example:
Draw a flowchart for a program that prints
the classification of the weather according to
the following temperature classification:
Below 15 : Cold
Between 15 and 28 : moderate
Above 28 : Hot

Read T
No

No

Solution


Start

Print “Moderate”

Step 2 : identify output


Depending on the value of T the output will be
cold, moderate ,or hot

Step 3: Construct the algorithm
a.
b.
c.
d.

Input temperature (T)
If T < 15 then print “Cold” else step c
If T < 28 then print “Moderate” else step d
Print “Hot”

Yes

Print “Cold”

Temperature (T)
Print “Hot”



Yes

Step 1 : Identify input




T < 28

T < 15

Stop

Branching Flowcharts (5)
Finds largest among three numbers – 1st solution





Example:
Draw a flowchart for a program that prints
the maximum number among three
numbers.







Solution


Step 1 : Identify input


Step 2 : identify output

Three Numbers ( A , B , C )

Start

The largest among A , B , and C

Step 3: Construct the algorithm
a.
b.
c.
d.
e.
f.

Input three numbers (A , B , C)
If A > B then step c else step e
If A > C then print A else print C
stop
If B > C then print B else print C
stop

A,B,C
No

No

Print C

B>C

Yes

A>B
No

Yes

Print C

Print B

Stop

A>C

Yes

Print A

Branching Flowcharts (6)
Finds largest among three numbers – 2nd solution





Example:
Draw a flowchart for a program that prints
the maximum number among three
numbers.







Solution


Step 1 : Identify input


Step 2 : identify output

Three Numbers ( A , B , C )

Start

The largest among A , B , and C

Step 3: Construct the algorithm
a.
b.
c.
d.
e.
f.

Input three numbers (A , B , C)
If B > C then step c else step e
If B > A then print B else print A
stop
If C > A then print C else print A
stop

A,B,C
No

No

Print A

C>A

Yes

B>C
No

Yes

Print A

Print C

Stop

B>A

Yes

Print B

Branching Flowcharts (7)
Finds largest among three numbers – 3rd solution





Example:
Draw a flowchart for a program that prints
the maximum number among three
numbers.



Step 2 : identify output




Step 3: Construct the algorithm
a.
b.
c.
d.
e.
f.

Solution


Step 1 : Identify input


The largest among A , B , and C

Three Numbers ( A , B , C )

Start

Input three numbers (A , B , C)
If B > C then step c else step e
If B > A then max = B else print max = A
stop
If C > A then max = C else max = A
stop

A,B,C
No

No

max = A

C>A

Yes

B>C
No

Yes

max = A

max = C

Print max

Stop

B>A

Yes

max = B

Branching Flowcharts (8)
Finds largest among three numbers – 4th solution




Example:
Draw a flowchart for a program that prints the
maximum number among three numbers.
Solution


Step 1 : Identify input





max = a
B > max

Yes

The largest among A , B , and C

Step 3: Construct the algorithm
a.
b.
c.
d.
e.

A,B,C

Three Numbers ( A , B , C )

Step 2 : identify output


Start

Input three numbers (A , B , C)
Set max = A
If B > max then max =B
If C > max then max = C
stop

No

C > max
No

Print max

Stop

max = B

Yes

max = C

Branching Flowcharts (9)
Finds largest among fourth numbers



Question
Draw a flowchart for a program that prints
the maximum number among four numbers.



The flowchart below is the solution of the
question on the left.
If the question requires finding the max
among 100 numbers then how long the
resulted flowchart will be???!!!!
There should be another approach to solve
it!




Start
A,B,C,D

No

Yes

A>B

No
B>C

Yes

No

Yes

No

C>D

Print D

Print C

Print D

No
A>C

Yes

Yes

No

B>D

Yes

Print B

Print D

Stop

Yes

No
A>D

C>D

Print C

Print D

Print A

Looping Flowcharts (1)
Print the word Tabuk 100 times



Example:
Draw a flowchart for a program that
prints the word TABUK 100 times.



Solution


C=1

Step 1 : Identify input




Start

No input required (input inside the
algorithm)

No

C<=100

Step 2 : identify output


Printing the word TABUK 100
times

Yes
Stop



Step 3: Construct the algorithm
a.
b.
c.
d.
e.
f.

Set C = 1
If C<= 100 then step c else step f
Print “TABUK”
Set C = C + 1
Go to step b
stop

Print “TABUK”

C = C +1

Looping Flowcharts (2)
Print numbers from 1 to 100



Example:
Draw a flowchart for a program that
prints the numbers from 1 to 100



Solution


C=1

Step 1 : Identify input




Start

No input required (input inside the
algorithm)

No

C<=100

Step 2 : identify output


Printing numbers from 1 to 100
Yes



Step 3: Construct the algorithm
a.
b.
c.
d.
e.
f.

Set C = 1
If C<= 100 then step c else step f
Print C
Set C = C + 1
Go to step b
stop

Stop

Print C

C = C +1

Looping Flowcharts (3)
prints numbers from 1 to N



Example:
Draw a flowchart for a program that
prints the numbers from 1 to N



Solution


The limit to print to (N)

Input N

Step 2 : identify output




C=1

Step 1 : Identify input




Start

Printing numbers from 1 to N

Step 3: Construct the algorithm
a.
b.
c.
d.
e.
f.

Set C = 1
If C<= N then step c else step f
Print C
Set C = C + 1
Go to step b
stop

No

C<=N
Yes

Stop

Print C

C = C +1

Looping Flowcharts (4)
Prints the word Tabuk N times



Example:
Draw a flowchart for a program that
prints the word TABUK N times



Solution


The limit to print to (N)

Input N

Step 2 : identify output




C=1

Step 1 : Identify input




Start

Printing the word TABUK N times

Step 3: Construct the algorithm
a.
b.
c.
d.
e.
f.

Set C = 1
If C<= N then step c else step f
Print “TABUK”
Set C = C + 1
Go to step b
stop

No

C<=N
Yes

Stop

Print “TABUK”

C = C +1

Looping Flowcharts (5)
Sums numbers from 1 to N



Example:
Draw a flowchart for a program that
sums the numbers from 1 to N



Solution

Start
C=1







The limit to print to (N)

Input N

Step 2 : identify output




S=0

Step 1 : Identify input

Sum of numbers from 1 to N (S)

Step 3: Construct the algorithm
a.
b.
c.
d.
e.
f.
g.
h.

Set C = 1
Set S = 0
If C<= N then step d else step g
Set S = S + C
Set C = C + 1
Go to step c
Print S
stop

No

C<=N
Yes

Print S

S=S+C

Stop

C = C +1

Looping Flowcharts (6)
Sums N numbers



Example:
Draw a flowchart for a program that
reads N numbers and prints their
summation.

Start

C=1
S=0



Solution


Input N

Step 1 : Identify input



The number of numbers to read (N)
The numbers to read (M)
No







C<=N

Step 2 : identify output
Sum of N numbers (S)

Step 3: Construct the algorithm
a.
b.
c.
d.
e.
f.
g.
h.
i.

Set C = 1
Set S = 0
If C<= N then step d else step h
Read M
Set S = S + M
Set C = C + 1
Go to step c
Print S
stop

Yes

Print S
Read M
Stop

S=S+M

C = C +1

Looping Flowcharts (7)
Finds the average of N numbers



Example:
Draw a flowchart for a program that
reads N numbers and prints their
average.

Start

C=1
S=0



Solution


Input N

Step 1 : Identify input



The number of numbers to read (N)
The numbers to read (M)
No







C<=N

Step 2 : identify output
average of N numbers (AVG)

Step 3: Construct the algorithm
a.
b.
c.
d.
e.
f.
g.
h.
i.
j.

Set C = 1
Set S = 0
If C<= N then step d else step h
Read M
Set S = S + M
Set C = C + 1
Go to step c
AVG = S / N
Print AVG
stop

Yes

AVG= S / N

Read M

Print S

S=S+M
Stop

C = C +1

Looping Flowcharts (8)
Count pass marks





Example:
Draw a flowchart for a program that
reads N marks and prints number of
marks above or equal to 60.

Start
C=1
Count = 0

Solution


Input N

Step 1 : Identify input



The number of numbers to read (N)
The numbers to read (M)
No







C<=N

Step 2 : identify output
Number of marks above or equal to
60 (Count)

Yes

Print Count
Read M

Step 3: Construct the algorithm
a.
b.
c.
d.
e.
f.
g.
h.
i.
j.

Set C = 1
Set Count = 0
If C<= N then step d else step i
Read M
If M >=60 then step f else step g
Set Count = Count + 1
Set C = C + 1
Go to step c
Print S
stop

Stop

M>=60
Yes
No
Count= Count + 1

C = C +1


Flowchart (1).pdf - page 1/22
 
Flowchart (1).pdf - page 2/22
Flowchart (1).pdf - page 3/22
Flowchart (1).pdf - page 4/22
Flowchart (1).pdf - page 5/22
Flowchart (1).pdf - page 6/22
 




Télécharger le fichier (PDF)


Flowchart (1).pdf (PDF, 285 Ko)

Télécharger
Formats alternatifs: ZIP



Documents similaires


flowchart 1
mva 2015 rl7
reflexicons version 3
nmeth 1371
multi genomic algorithms
mva 2015 mgce

Sur le même sujet..