+ 1
I made a code using the "if" statement. The second use of it doesnt work. The code is the last code I made on my profile. Help?
I need a solution to fix a problem in a code. It wont show the problem. It's just not running it. It skips it. https://code.sololearn.com/crXvIi33H344/?ref=app https://code.sololearn.com/crXvIi33H344/?ref=app
14 Answers
+ 16
Check conditions (a>b) & (b<a) are identical, after correcting them program will work good
+ 16
yes, you can use if else but in this case all the conditions are mutually exclusive & complete all possible cases so it will not affect the result.
//but you will be free to not test the last condition, and directly print the last statement in else {} block, like :
if(a>b) {}
else if(b<a) {}
else {} //here no need to write test condition (a==b) as its the only condition possible if other 2 are false.
+ 3
I just saw that 😂😂😂 my uncle had to tell me
+ 2
First off, sololearn codeground it's not a good get more than 1 value to do something in your code so please try it on your computer with a compiler
+ 2
I fixed it so u can see how I wanted it cause I dont remember
+ 2
Juan David Padilla Diaz
Yes I would use else if, else also. However when helping new learners I prefer to help them fix their logic, rather than rewrite the logic for them.
+ 1
I dont have a computer, sadly
+ 1
If you have Android search on Google play store CXX droid it's a compiler of c++ for phones
+ 1
Ok, so the second if needs fixing. Use > instead of < then it should work how you expect.
+ 1
I'm not there yet. I just finished the if lesson
+ 1
Ok
0
Jared Bird instead I'd use an else condition
0
Although the text then doesn't match up. Should the second statement be greater or less?
Was your goal to print:
First is bigger, or
Second is bigger, or
The same.
(Or something to that effect?)