what will be the output of the following pseudo code? Set fun = 6 Set goal = 9…
2024
what will be the output of the following pseudo code?
Set fun = 6
Set goal = 9
Set sum1 = 0
Set n = 2
if (goal is greater than fun):
for(n=f; n
sum1=sum1+n
else:
Write Error messages
Write sum1
- A.
18
- B.
15
- C.
10
- D.
2
Attempted by 30 students.
Show answer & explanation
Correct answer: A
The output will be 18. The loop executes three times, incrementing sum1 in each iteration.