C MCQ : if statement > Non Zero number inside if statement
#include<stdio.h> void main() { int num=10; if(num) printf("If Executed"); else printf("Else Executed"); }
Options :
- If Executed
- Else Executed
- Compile Error : If Statement must have Condition.
- Run-Time Error
Why & How ?
Non Zero Number is TRUE
- Any number except Zero in If is considered as TRUE
- Value of Variable "num = 10" which is Considered as TRUE
- So IF block gets executed
0 comments:
Post a Comment
Your Feedback : This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email