Vous êtes sur la page 1sur 2

DEPARTMENT OF ELECTRONIC ENGINEERING TECHNOLOGY

VGT114 Technology System Programming I Lab Module

 LABSHEET 2 DATE TITLE Pseudocode & Flowchart MATRIC NO CHAPTER Introduction to Problem Solving NAME

Based on the following information regarding input, output and process, write the pseudocode and flowchart to solve the problem.

Problem: Determine whether profit, return capital or loss Input:

Purchase price

Selling price

Output: Message "Profit" or "Return Capital" or "Loss" Process:

Difference = Purchase price - Selling price If Difference > 0, Output = "Profit" If Difference = 0, Output = "Return Capital" If Difference < 0, Output = "Loss"

Trace the following pseudocode and record the output statements in the following table.

This program prints a pattern within loops.

Read value Set counter = 0 WHILE value is not 0 IF value is not 2 or 4 Print "*"

ELSE

Print "@"

ENDIF Print ">" counter = counter + 1 Read value ENDWHILE

 Input Value Output Statement 1 2 3 4 5 6 3 0 3 2 0 5 6 8 4

P a g e

1

|

2