C MCQ : if statement > Logical OR Operator inside if ….. Guess What will be the Output ?
#include<stdio.h> void main() { if(1 || 0) printf("Dennis Ritchie is Father of C Programming"); else printf("Why to learn C ?"); }
Options :
- Why to learn C ?
- Compile Error
- Dennis Ritchie is Father of C Programming
- Run time Error
[toggle title="Output"]Dennis Ritchie is Father of C Programming[/toggle]
Why & How ?
- OR Operator is used .
- If any of the case is True then If block will be executed.
- If it founds First Operand as non-zero number then it declare whole statement as TRUE statement