0% found this document useful (0 votes)
15 views3 pages

Programming Bazar Mark

The document provides examples of algorithms and pseudocode for calculating the perimeter and area of a rectangle, computing an object's weight on the moon, and identifying if a number is divisible by 5. Formulas and step-by-step processes are described for each example problem.

Uploaded by

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

Programming Bazar Mark

The document provides examples of algorithms and pseudocode for calculating the perimeter and area of a rectangle, computing an object's weight on the moon, and identifying if a number is divisible by 5. Formulas and step-by-step processes are described for each example problem.

Uploaded by

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

BAZAR, MARK B.

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

Give the value of mass as mass variable Mass

Let gravity (g) = 9.8


g = 9.8
Multiply the moon gravity, mass gravity and
put the answer as weight (w). w = 1/6 * mass * g

Display the value of weight (w)

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

You might also like