What will be the value of x after the following code is executed? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What will be the value of x after the following code is executed?

int x = 10; for (int y = 5; y < 20; y +=5) x += y;

3rd Oct 2017, 1:00 AM
natet2014
natet2014 - avatar
1 Answer
+ 4
Values of y considered: 5 10 15 10+5+10+15=40 Thus, x becomes 40
3rd Oct 2017, 1:04 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar