Complex condition:-
ऐसी कई situations हैं जहां एक से अधिक conditions का test करने की आवश्यकता हो सकती है और स्थिति के result के आधार पर हम दो विकल्पों में से एक को चुनते हैं।. We classify complex condition into three categories:
i. && (AND):-
जब दिए हुए सभी expression ‘true’ होते है तो ये ‘true’ return करता है। अगर हुए expressions से एक expression अगर false हुई तो ये false return करता है।
Syntax:- if(condi1&&condi2&&….)
Statement1;
else
Statement2;
Questions:- 1. Wap to input age and nationality of a person and check whether the person is eligible for vote in India or not.
2. Wap to check the division of Student according to percentage.
3. Wap to check whether given the character alphabet or not.
4. Wap to check lower case & upper case.
ii. || (OR):- जब दिए हुए सभी Expressions में से एक expression अगर ‘true’ होता है तो ये ‘true’ return करता है।
Syntax:- if(condi 1 || condi 2 || ….)
Statement 1;
else
Statement2;
Questions:- 1. Wap to input a letter and check whether it is vowel or consonant.
iii. Not (!):- Logical NOT Operator जब expression false होता है तब ‘true’ return करता है और अगर expression true होता है तो ‘false’ return करता है।
Complex condition:-
There are many situations where there may be a need to test more than one condition and depending on the outcome of the condition we choose one of the two options. We classify complex condition into three categories:
i. && (AND):-
When all the given expressions are ‘true’ then it returns ‘true’. If one of the expressions is false then it returns false.
Syntax:- if(condi1&&condi2&&….)
Statement1;
else
Statement2;
Questions:- 1. Wap to input age and nationality of a person and check whether the person is eligible for vote in India or not.
2. Wap to check the division of Student according to percentage.
3. Wap to check whether given the character alphabet or not.
4. Wap to check lower case & upper case.
ii. || (OR):- When one of the given expressions is ‘true’ then it returns ‘true’.
Syntax:- if(condi 1 || condi 2 || ….)
Statement 1;
else
Statement2;
Questions:- 1. Wap to input a letter and check whether it is vowel or consonant.
iii. Not (!):-Logical NOT Operator returns ‘true’ when the expression is false and returns ‘false’ if the expression is true.