Hi, pertaining to 'if conditions' and all its statements like "else, else if, if", if one condition of whole conditions thats written in the script(lets say there's more than two "if" conditions) achieved then the program will not continue to another condition however if there's another "if condition" that the program can achieve it.. right? (see the example below to be more simply-btw the code is just for understanding so don't focus of what it prints)
In my case, the code achieves the first "if" ofcourse, because the variable num is smaller than 3, so it prints on my screen "hello", however we can easily see it also achieves the second "else if", but the code doesn't print "hh" in my screen and thats weird for me!! because from my knowledge the "else if" and "if" equivalent to each other so in my case the program must enter the second condition also...am I right? if not so, then can anyone please me explain what're the differences between them? thanks in advance.Code:#include<stdio.h> int main() { int num=2,i=0; if(num<3) printf("hello"); else if (num<5) printf("hh"); else printf("No"); return 0; }