0

#include <stdio.h> int main() { int x=12 , y=15 , z=20; if(x>y<z) printf ("red"); else printf ("green"); return 0; }

Any one can suggest how it's out put come red.

5th May 2021, 3:15 PM
Ritik Kumar
5 Réponses
+ 1
x>y<z // x is NOT greater, so it breaks down to 0 0<z //0 is less than 20 so it passes
5th May 2021, 3:17 PM
Slick
Slick - avatar
+ 2
Slick isn't it checking from right to left? I think y<z=1(true) so x>1 and we get the same result. But I may be wrong
5th May 2021, 3:49 PM
Michal Doruch
+ 1
Michał Doruch Yeah, i think you're right! That's my mistake in the order of operations
5th May 2021, 3:53 PM
Slick
Slick - avatar