The program checks if the user-provided input (num
) is greater than 20 and less than 22.
If the user enters 25
, the condition num > 20 AND num < 22
evaluates as follows:
25 > 20
istrue
25 < 22
isfalse
Since both conditions must be true for the entire expression to be true and one of them is false, the overall condition is false
.
Therefore, the program will execute the ELSE
branch and output:
"Invalid."