What is the output of this code? int result = 0; for (int i = 0; i < 5; i++) { if (i == 3) { result += 10; } else { | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the output of this code? int result = 0; for (int i = 0; i < 5; i++) { if (i == 3) { result += 10; } else {

5th Mar 2017, 9:51 PM
ABDERRAZAQ NADIR
ABDERRAZAQ NADIR - avatar
3 Answers
0
Your code is kinda missing the else statement
5th Mar 2017, 9:53 PM
Trabelsi Haythem
Trabelsi Haythem - avatar
0
show the end of your code, cycle isn't complete and there's no output statement. from what we can see now, you'll get "result +=10" only once in your cycle
5th Mar 2017, 10:20 PM
Андрій Дем'яненко
Андрій Дем'яненко - avatar
0
17
24th Apr 2017, 10:04 AM
salah eddine hamlaoui
salah eddine hamlaoui - avatar