Read this section of program code that inputs 0 positive numbers and then outputs the total. Total = Counter = repeat input num total = Total + Num print total Counter = Counter + until counter = 10 This code works, but it is inefficient


Download 0.75 Mb.
Pdf ko'rish
bet1/2
Sana08.06.2023
Hajmi0.75 Mb.
#1464858
  1   2
Bog'liq
Homework



Read this section of program code that inputs 10 positive numbers and then outputs the total.
1 Total = 0
2 Counter = 0

REPEAT
4 INPUT Num
5 Total = Total + Num
6 PRINT Total
7 Counter = Counter + 1
8 UNTIL Counter = 10
This code works, but it is inefficient.
(i)
Suggest three improvements that could be made.
1 .................................................................................................................................................
...................................................................................................................................................
2 .................................................................................................................................................
...................................................................................................................................................
3 .................................................................................................................................................
...............................................................................................................................................[3]
(ii) 
Rewrite the program code with your improvements.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
HOMEWORK: DEADLINE - 01/05/2023



Download 0.75 Mb.

Do'stlaringiz bilan baham:
  1   2




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling