Can someone tell me why this code doesn't work?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can someone tell me why this code doesn't work??

https://code.sololearn.com/cdd7hd5ljQy1/?ref=app

22nd Jun 2020, 4:49 AM
Laiz N
Laiz N - avatar
6 Answers
+ 5
For the sake of compatibility, prefer `&&` operator over the alias 'and'. Most C++ coders write boolean expressions using `&&` operator, while 'and' is an occasionally option.
22nd Jun 2020, 6:02 AM
Ipang
+ 4
The "if" statement are comparing two senteces. ( compare1 ) "and" ( compare2 ) = boole result. //true or false you wrote : "else if ( a >= 400 and <= 699){ " observe the second compare sentence. it`s something missing. "699 <= ?(missing thing)" ex.: if ( a >= 400 and a <= 699) I hope it helps. Have a nice coding.
22nd Jun 2020, 5:07 AM
Bruno Franco
Bruno Franco - avatar
22nd Jun 2020, 5:17 AM
Ptar*
Ptar* - avatar
+ 3
your first if and last else if !!!!!!!! check those conditions here they are overlapping at a = 1000 so if a= 1000 then it will the first result and then exit!!!!!
22nd Jun 2020, 5:07 PM
Abhishek Dimri
Abhishek Dimri - avatar
+ 2
Bruno Franco Explained Right Laiz N Because You’re Using and keyword so both of the conditions seems to be true but in right side expression you won’t compared your variable ‘a’ which arised error in your code. Here I Made Corrections In Your Code 😊 https://code.sololearn.com/c779ViTLIPsW/?ref=app
22nd Jun 2020, 5:13 AM
Rahul Saxena
Rahul Saxena - avatar
+ 2
Ah ha..thanks so much guys, that totally cleared things up for me..
22nd Jun 2020, 6:15 AM
Laiz N
Laiz N - avatar