0

#include <stdio.h> int main() { int x = 5; if (x<1); {printf("Hello");} }

Why hello is displaying even if the condition is not true

15th Dec 2019, 2:33 PM
Avantika Nagrale
2 Antworten
+ 2
Because you have used semicolon after if(x<1), your printf statement is no longer a part of if() block. Remove semicolon.
15th Dec 2019, 2:34 PM
Chetali Shah
Chetali Shah - avatar
+ 1
Hey thank Uuu
15th Dec 2019, 2:36 PM
Avantika Nagrale