Programming Bazar Mark
Programming Bazar Mark
Create the algorithm or pseudocode of the following, then draw their respective flowchart.
1. Perimeter and Area of a Rectangle. Formulas: perimeter = 2 * length + 2 * width, area =
length * width.
ALGORITHM PSEUDOCODE
BEGIN
GIVE THE VALUE OF LENGTH (L) INPUT L
GIVE THE VALUE OF WIDTH(W) INPUT W
IF PERIMETER (P) OF A RECTANGLE, THEN IF P THEN “P = 2L * 2W”
“P = 2L * 2W”, ELSE A, “A = L * W” ELSE A, “A = L * W”
DISPLAY P OUTPUT P
DISPLAY A OUTPUT A
BEGIN
INPUT L INPUT W P?
Y “P = 2L * 2W”
N OUTPUT
P
“A = L * W”
OUTPUT
A
END
2. Computing for the weight of an object in the moon. Formula: weight = 1/6 * mass * gravity.
Take note that the gravity has a constant value of 9.8.
ALGORITHM PSEUDOCODE
BEGIN
Give the value of moon gravity as 1/6 1/6
variable
OUTPUT w
END
BEGIN
1/6
INPUT
mass
g = 9.8
W = 1/6 * mass * g
OUTPUT
END
w
3. Identify if the inputted number is divisible by 5 or not. Hint: Use modulus division for this.
ALGORITHM PSEUDOCODE
BEGIN
GIVE THE VALUE OF X AS X INPUT X
VARIABLE.
REMAINDER = X % 5
REMAINDER = X % 5.
IF REMAINDER ==0
IF REMAINDER IS 0, THEN DISPLAY
THE WORD “YES”; ELSE DISPLAY NO. OUTPUT “YES”
ELSE OUTPUT “NO”
END
BEGIN INPUT X
REMAINDER = X % 5
REMAINDER
==0?
OUTPUT OUTPUT
“NO” “YES”
END