Need a little help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Need a little help

#include<stdio.h> int main () { int a=10, b=20, c=30; if (c>b>a) printf("True"); else printf("False"); return 0; } I compiled it, and answer is false.. why??

14th Jan 2018, 11:31 AM
Ayush walia
Ayush walia - avatar
1 Answer
+ 39
Rewrite the if statement like this: c > b && b > a Reason why you get false: c > b - the result is true, true > a - the result is false. https://www.sololearn.com/learn/CPlusPlus/1619/
14th Jan 2018, 11:35 AM
Igor Makarsky
Igor Makarsky - avatar