This pseudocode will iterate over the while loop 3 times because the condition i<5 will be true when i is 2, 3, and 4. Here is the step by step execution of the pseudocode:
i is initialized to 2 and a is set to 6.Check the condition i<5, which is true (2<5).Execute the block inside the loop: a = a + i, so a becomes 8 and i becomes 3.Check the condition i<5, which is true (3<5).Execute the block inside the loop: a = a + i, so a becomes 11 and i becomes 4.Check the condition i<5, which is true (4<5).Execute the block inside the loop: a = a + i, so a becomes 15 and i becomes 5.Check the condition i<5, which is false (5 is not less than 5).Exit the loop.
After the while loop completes, the final values of i and a will be i=5 and a=15.
This pseudocode will iterate over the while loop 3 times because the condition i<5 will be true when i is 2, 3, and 4. Here is the step by step execution of the pseudocode:
i is initialized to 2 and a is set to 6.Check the condition i<5, which is true (2<5).Execute the block inside the loop: a = a + i, so a becomes 8 and i becomes 3.Check the condition i<5, which is true (3<5).Execute the block inside the loop: a = a + i, so a becomes 11 and i becomes 4.Check the condition i<5, which is true (4<5).Execute the block inside the loop: a = a + i, so a becomes 15 and i becomes 5.Check the condition i<5, which is false (5 is not less than 5).Exit the loop.After the while loop completes, the final values of i and a will be i=5 and a=15.