Professional Documents
Culture Documents
Group 5 Computer Algorithm Lab 2
Group 5 Computer Algorithm Lab 2
Group 5 Computer Algorithm Lab 2
ALGORITMA KOMPUTER
SECTION: 5
LAB: 2
STUDENT NAME
NAME MATRIK NUMBER
ALLY AKHTAR BIN ANWAR AA232367
MUHAMMAD IKHWAN ASHRAF BIN MOHD RAZIF AA230429
MUHAMMAD IZAM IZANI BIN MOHD NAZIHA AA231986
Write the pseudocode (basic and detail) and draw the flowchart for each of the
following problem based on your Lab 1.
1. Calculate the new salary after a 15% increase.
Start
Declare variables
Input salary
Calculate new salary
Display sum
End
2. Detail
Begin
Declare aos,ns
Display “Enter your salary”
Get aos
Calculate ns=(0.15*aos)+aos
Display “New Salary”
Stop
Flowchart:
CONCLUSION : In conclusion the old salary is 7500.The new salary aftrer 15%
increase is 8625.
2. Calculate the average mark of five students.
Pseudocode:
1. Basic
Start
Declare variables
Input mark student
Calculate 5 numbers and divide all by the number of marks
Print the average mark
End
2. Detail
Begin
Declare ms1,ms2,ms3,ms4,ms5
Display “Enter mark student 1”
Display “Enter mark student 2”
Display “Enter mark student 3”
Display “Enter mark student 4”
Display “Enter mark student 5”
Get ms1,ms2,ms3,ms4,ms5
Calculate av = (ms1 + ms2 + ms3 + ms4 + ms5) / 5
Display “average mark”
Stop
Flowchart:
CONCLUSION :
In order to get the average mark, the total mark of five students were divided by 5 and
get 84 as the answer.
3. Calculate the new price after a 10% discount.
Pseudocode:
1. Basic
Start
Declare variables
Input original price
Calculate new price after discount
Display new price
End
2. Detail
Start
Declare originalprice As float
Display “Enter original price”
Get original price
Calculate new price =(0.1 * originalprice) – originalprice
Print “new price: ”, np
End
Flowchart:
CONCLUSION :
To sum up, to get the new price after 10% discount is, the original price need to multipy
with 0.1 and minus by original price and the answer is 72546.80.
4. Calculate the volume of a pyramid.
Pseudocode:
1. Basic
Start
Declare variables
Input height of pyramid,length of pyramid,width of pyramid
Calculate volume of pyramid = (p_h * p_l * p_w / 3)
Display Volume of pyramid
End
2. Detail
Begin
Declare p_h, p_l, p_w
Display “Enter height of pyramid”
Display “Enter length of pyramid”
Display “Enter width of pyramid”
Get p_h, p_l, p_w
Calculate vop = (p_h * p_l * p_w / 3)
Display “Volume of pyramid”
Flowchart:
Conclusion:
In order to get volume of pyramid, the pyramid’s height, length and width need to be multiply
and divided by 3. The answer should be 58.3333.