LC 4
LC 4
Techniques
Class Code: jnmqmw5
• Prevents errors: Planning reduces the chance of bugs in the later stages.
• Saves time: A good design ensures smoother coding and fewer rewrites.
• Enhances teamwork: Provides clarity when working with other
developers.
• Ensures scalability: A well-structured design allows future modifications
or extensions.
Pseudo Code
• Write a pseudo code and draw a flow chart to convert the length
in centimeter to meter.
Example
• Pseudo code:
• Input the length in centimeter (Lcm).
• Calculate the length in m (Lm) by dividing Lcm by
100.
• Print length in m (Lm)
Flow chart
Practice:
Write a pseudo code and draw a flow chart that will read
the two sides of a rectangle and calculate its area.
Practice:
Suppose a retail business is planning to have a storewide sale
where the prices of all items will be 20 percent off. Write a
pseudo code and draw a flow chart to calculate the sale price
of an item after the discount is subtracted.
Decision structure
• Write a pseudo code and draw a flow chart that will read two
numbers, determines the largest value and prints a message
with the largest value
Example
• Pseudo code:
Input the value1 and value2
If (value1 > value2)
set max = value1
Else
set max = value2
endif
Print “The largest value is”, (max)
Flow chart
Practice:
Write a pseudo code and draw a flow chart that will add a
10% bonus for the employees if the sales was greater than
50000.
Practice:
Write a pseudo code and draw a flow chart that will read 3
test scores for the students and calculate the average
score. Display the average score. Also display a
congratulation message if the average is greater than 95.
Any Questions?