You are on page 1of 2

3F.

3 Raptor HW 4 Answer Sheet


Class: 3b Class No.: 12
Name: Lau cheuk ling
Part 1
Answer the questions below:
1. 20
12
6
2
0
2. 5
3. No output
4.
5. 2
it is repeated
6(i). The loop never stop
6(ii). If don’t minus input by 1, it will never become 0 and stop.
Part 2 It more clearly to see the logic and easier for fix bug.
Bonus

Part 2
Paste the flowchart below:
Start

Loop

"input a number"GET i

Yes No
i>0

Yes No
10 mod i = 0 PUT "Positive number is expected."¶

a←0
a←1 PUT "Integral number is expected."¶

a←0

Yes
a=1

No

total ← 0

Loop

Yes
i=0

No

Yes No
i !=0

PUT i * (i - 1)¶

total ← total + i * (i - 1)

i←i-1

PUT total¶

End

You might also like