0% found this document useful (0 votes)
2 views2 pages

Tutorial 3 Exercise Designs

The document outlines the correct designs for various programming challenges, including loops and conditional statements. Each program is structured to perform specific tasks such as calculating squares, managing salary deductions, and determining even or odd numbers. The designs serve as a reference for understanding mistakes made in previous attempts.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Tutorial 3 Exercise Designs

The document outlines the correct designs for various programming challenges, including loops and conditional statements. Each program is structured to perform specific tasks such as calculating squares, managing salary deductions, and determining even or odd numbers. The designs serve as a reference for understanding mistakes made in previous attempts.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Below are the correct designs for each of the programmes I challenged you with.

Review
them with or group mates understand where you made your mistakes. You can deduce
the Analysis and the Execution from these designs for each program.

1.
1 Start
2 Count as real
3 Square as real
4 Count = 1
5 Loop until Count > 10
6 Square = count * count
7 Output Square
8 Count = count + 1
9 EndLoop
10 Stop

2.
1 Start
2 Salary as real
3 Output “Enter Salary
4 Input Salary
5 Loop until Salary == 0
6 Salary = Salary – 100
7 Output Square
8 EndLoop
9 Stop

3.
1 Start
2 Amount as real
3 Price as real
4 Output “Enter Amount”
5 Input Amount
6 Loop until Amount == 0
7 Output “Enter Price”
8 Input Price
9 If Amount > Price then
10 Amount = Amount – Price
11 Output Amount
12 Else
13 Output “Insu icient Funds for item”
14 EndIf
15 EndLoop
16 Stop
4.
1 Start
2 Count as real
3 Number as real
4 Quotient as real
5 Count = 1
6 Loop until count > 4
7 Output “Enter number”
8 Input Number
9 Number = Number + 1
10 Quotient = Number/2
11 If Quotient == 0 then
12 Output “Even”
13 Else If Quotient > 0 then
14 Output “Odd”
15 Else
16 Output “Unknown”
17 EndIf
18 Count = Count + 1
19 EndLoop
20 Stop
5.
1 Start
2 Count as real
3 Num1 as real
4 Num2 as real
5 Di erence as real
6 Output “Enter Num1”
7 Input “Num1”
8 Output “Enter Num2”
9 Input Num2
10 Count = 0
11 Di erence = Num1 – Num2
12 If Di erence > 0 then
13 Loop until Count > Di erence
14 Output Count
15 Count = Count + 1
16 EndLoop
17 Else
18 Loop until Count < Di erence
19 Output Count
20 Count = Count - 1
21 EndLoop
22 EndIf
23 Stop

You might also like