Why does this code throw errors at me? (Fixed) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why does this code throw errors at me? (Fixed)

So I’ve been doing code coach and the errors are happening on the question „that’s odd...“ the code really doesn’t seem to like line 17 wich is odd since there shouldn’t be any error. Hope you guys can tell me what’s wrong with this :) Code: https://code.sololearn.com/cCfG6AOMwg69/?ref=app Edit: I could fix line 17 but line 21 and 27 show an error now :/

18th Aug 2020, 8:56 AM
nanew
nanew - avatar
3 Answers
+ 1
`=` and `==` are different operators. = assigns value to left hand operand. == compares operands for equality. on line 17 use = for assignment int i = 0;
18th Aug 2020, 8:59 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
0
Md. Nasif-ur-Rahman Rimon the error on 21 is fixed now but 27 is still there, the error says im using unassigned variable ‘sum’
18th Aug 2020, 9:05 AM
nanew
nanew - avatar
0
Md. Nasif-ur-Rahman Rimon thanks for your help its fixed now :P
18th Aug 2020, 9:11 AM
nanew
nanew - avatar