+ 1

if(1<2&&2>1) is it true or false?

The above question asked while online viva it's true but teacher said it's false. He said you should think about it again, i didn't get what he actually want to say, if someone understand, please help

11th Jul 2020, 4:56 AM
Ikram Arshad
Ikram Arshad - avatar
3 Answers
+ 4
Its definitely true. Because 1<2 is true. And 2>1 is also true So true && true is true. Ask your teacher to explain this 😂😂😂 You will feel proud on yourself that u are correct
11th Jul 2020, 5:01 AM
ツSampriya😘ツ
ツSampriya😘ツ - avatar
+ 1
The answer is true not false. 1 < 2 = true 2 > 1 = true Boolean algebra (0 = false, 1 = true) AND 0 0 -> 0 0 1 -> 0 1 0 -> 0 1 1 -> 1
11th Jul 2020, 5:03 AM
Emanuel Maliaño
Emanuel Maliaño - avatar
0
maybe your teacher think && has higher precedence. so. 1<2&&2>1 1<(2&&2)>1 1<true>1 which is wrong, and probably throw an error. maybe C++ will still evaluate as false, but i bet it'll also at least give a warning. see the answer before mine, to see the right reason why your answer is right
11th Jul 2020, 5:08 AM
Taste
Taste - avatar