Neco 2018 Computer Studies Question 15
Practice objective / multiple choice question 15 from the 2018 Neco Computer Studies examination.
Consider the following Python code intended to compute the sum of all natural numbers less than N that are multiples of 3 or 5: ```python total = 0 for i in range(1, N): if i % 3 == 0 and i % 5 == 0: total += i print(total) ``` If the variable `N` is set to 20, (a) identify the logical error in the code, (b) rewrite the condition correctly, and (c) give the correct output produced by the corrected program.
Answer Options
About This Question
This is Neco 2018 Computer Studies Question 15. It is one of the objective questions from the 2018 Neco Computer Studies examination.
Difficulty level: Hard .
Master the Exam!
You've seen a preview, but there are thousands more questions plus AI tutor to break down complex solutions.