Q. What will be the output of the following code snippet?

Code:
var a = 1;  
var b = 0;  
while (a <= 3)  
{  
   a++;  
   b += a * 2;  
   print(b);
}
  • (A) 4 10 18
  • (B) 1 2 3
  • (C) 1 4 7
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (A) 4 10 18

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
309
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Admin
Publisher
πŸ“ˆ
99%
Success Rate