the program below is intended to count the number of prime numbers in a list called numbers and display the…

the program below is intended to count the number of prime numbers in a list called numbers and display the result. the program uses the procedure isprime (n), which returns true if n is a prime number and false otherwise. the program does not work as intended. line 1: count ← 0 line 2: for each value in numbers line 3: { line 4: count ← 0 line 5: if (isprime (value)) line 6: { line 7: count ← count + 1 line 8: } line 9: count ← count + 1 line 10: } line 11: display (count) 63 mark for review which two lines of code should be removed so that the program will work as intended? select two answers. line 1 line 4 line 7 line 9
Answer
Answer:
B. Line 4, D. Line 9
Explanation:
Step1: Analyze Line 4
Line 4 resets count to 0 inside the loop, which clears the accumulated count of prime - numbers for each iteration. It should be removed.
Step2: Analyze Line 9
Line 9 increments count unconditionally for each element in the list, not just when the element is prime. It should be removed.