+ 1

What are errors in this

if(code>1); a=b+c else a=0

17th Feb 2018, 4:20 PM
Anshul Sharma
Anshul Sharma - avatar
2 Antworten
+ 3
forgot semicolons ?
17th Feb 2018, 4:54 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
You have a semicolon after the if statement but nowhere else. You also have not defined a, b, or c. Here is a correct version int a, b, c; // give b and c values if (code > 1) a = b + c; else a = 0; You should also put braces around your if statements, but it's not required. int a, b, c; // give b and c values if (code > 1) { a = b + c; } else { a = 0; }
17th Feb 2018, 5:08 PM
Cailyn Baksh