Can any one tell me whats wrong. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
18th Jan 2019, 1:55 AM
Darren Gonsalves
Darren Gonsalves - avatar
4 Answers
+ 4
Line 5 : You missed the semicolon after the declaration. Line 12 : The condition inside if is a=!b. This will apply ! to b and then assign it to a. ! will convert a non-zero value to 0 and 0 to 1. Then assignment copies !b to a and then returns the value of a. In cases where b is non-zero, a becomes 0 and the if block is skipped. Thus replace the condition with a!=b.
18th Jan 2019, 2:30 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
18th Jan 2019, 2:30 AM
Koketso Dithipe
Koketso Dithipe - avatar
+ 4
int a,b;
18th Jan 2019, 2:28 AM
Calviղ
Calviղ - avatar
+ 3
Thanks
18th Jan 2019, 3:53 AM
Darren Gonsalves
Darren Gonsalves - avatar