0% found this document useful (0 votes)
20 views5 pages

CSC 103 Flowcharts

Uploaded by

Hussain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views5 pages

CSC 103 Flowcharts

Uploaded by

Hussain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

University of Bahrain

College of Information Technology

Department of Computer Science

Dr. Abdul Fattah Salman


CSC 103: Computer Programming for
Scientists and Engineers

Flowcharts
CSC 103: Dr. Abdul Fattah Salman slide #1 Flowcharts
Flowchart Symbols
start/end
An algorithm is an ordered sequence of
steps to solve a problem. An algorithm
process may be represented using pseudo-code or
flowcharts.
A flowchart is a graphical representation
input/output of the algorithm. The commonly used
graphical symbols used in flowcharts are
shown.
Predefined process A flowchart in which operations flow in
one direction (top  down) is called
sequential and usually doesn’t contain
decision decision symbols. It represents a
sequence code.
A flowchart containing a decision symbol
Flow lines & represents a code with selection or
connectors repetition structure.
CSC 103: Dr. Abdul Fattah Salman slide #2 Flowcharts
A Flowchart with Sequence
start
Question: Draw a flowchart that prompts
the user to enter from the KBD the length
and width of a rectangle then calculates Print “Enter
and prints the area and perimeter of len & wid”
rectangle.
read len, wid

Exercise #1: Draw a flowchart that area = len * wid


prompts the user to enter from the KBD perm = 2*(len+wid)
five test scores, calculates and prints the
scores and their average.
print len, wid,
area, perm

finish
CSC 103: Dr. Abdul Fattah Salman slide #3 Flowcharts
A Flowchart with Selection
A flowchart is branching if it contains a start
decision symbol.
Question: Draw a flowchart that:
1) Prompts the user to enter from the KBD an Print “Enter bas
employee’s basic salary (BS) in BD and the sal & mon work”
number of months worked (MW).
2) Calculate the tax as shown in the table. read BS & MW
Basic salary Tax (percentage
in BD of basic salary) true
false BS > 500
≤ 500 5%
> 500 8%
3) Compute total salary:TS =(BS –TAX ) x MW. TAX = 0.05xBS TAX = 0.08xBS
4) Display the values of TAX and TS.

Exercise #2: Draw a flowchart that prompts the


user to enter from the KBD the number N and type
of cinema tickets type to buy. Types and prices of TS = (BS -TAX) x MW
tickets are shown as follows.
Ticket type Price BD/ticket
print TAX, TS
Standard 3
3D 4
VIP 10 finish
CSC 103: Dr. Abdul Fattah Salman slide #4 Flowcharts
A Flowchart with Repetition
begin
Question: Draw a flowchart that:
1) Prompts the user to enter from
the KBD an integer number N. Print “Enter an
2) Calculates the factorial on F = N!. integer value N”
3) Displays the values of N and F.
read N

Exercise #3: Draw a flowchart that M=1; F=1


prompts the user to enter from the KBD N
integer numbers, calculates and prints the
count of positive (pos), negative (neg),
and zero (zer) values entered. F=FxM M=M+1

Exercise #4: Draw a flowchart that false


M= N?
prompts the user to enter from the KBD N
integer numbers, calculates and prints the true
sum of even (even), the count of odd print N, F
(odd) values entered.
finish
CSC 103: Dr. Abdul Fattah Salman slide #5 Flowcharts

You might also like