Gr 6.5 Psuedocode and flowchart_Trace table 5
Gr 6.5 Psuedocode and flowchart_Trace table 5
Pseudocode and
Flowchart
Pseudocode - is a sequence of instructions
to solve a problem, using simple words and
operators , and it can solve any problems
when it is used with the correct procedure.
1.Age 10
2.Marks99
3.Cost20.4
4.Gender “M”
5.Feespaid True
FLOWCHART
A graphical representation of
data, information and workflow
using certain symbols that are
connected to flow lines to
describe the instructions done in
problem solving.
Example: - Draw a flowchart –Ask user to input three
quiz score. And find the total score of all three quiz.
HW:- Basics of Programming
Worksheet 3
SEQUENCE CONSTRUCT
Sequence is the first programming
construct.
In programming, statements are
executed one after another. Sequence is
the order in which the statements are
executed.
Class Work
Example :1
START
OUTPUT “Enter three numbers”.
INPUT num1,num2,num3
Sum num1+num2+num3
OUTPUT “The addition of three numbers”, Sum
END
Example 2:
START
OUTPUT “Enter a number “
INPUT num
Square num*num
Cube num * num*num
OUTPUT “The square of a number is: “, Square
OUTPUT “ The cube of a number is: “, Cube
END
Example 3
START
OUTPUT “ Enter the height of a triangle”
INPUT height
OUTPUT “ Enter the base of a triangle”.
INPUT base
Area ½ * height * base
OUTPUT “ Area of a triangle”, Area
END
REVIEW OF WORKSHEET 4
HW QUESTIONS:
SELECTION
2. SELECTION
INPUT age
STOP
Example 2 :
Write a pseudocode and draw a flowchart to find whether the
employee is eligible to take bonus or not. If the employee’s experience
is more than or equal to 5 years, then print “BONUS” else print “NO
BONUS”.
START
OUTPUT “ Enter the experience of a person”.
INPUT experience
IF experience >=5 THEN
OUTPUT “BONUS”
ELSE
OUTPUT “NO BONUS”.
END
FLOWCHART
START
INPUT experience
IF
experi Yes
ence OUTPUT “ BONUS”
>=5
No
OUTPUT “ No
Bonus”
STOP
TRACE TABLE
START
INPUT experience
IF
experie Yes
nce OUTPUT “ BONUS”
>=5
No
OUTPUT “ No
Bonus”
STOP