Conditional statements are:-
-If then else conditional statements are used to execute if block when this is true if it is not true than it goes to the else block and execute it syntax for it:-
if(condition)
statement1;
else if(condition2)
statement2;
-Else if is the nested if else block that have multiple else blocks.
if(condition1)
statement1;
else if(condition2)
statement2;
else if(condition3)
statement3;
else
statement-n;
-Switch statements are also used to check multi way conditional statements.
switch(expression)
case choice1:
statement1;
case choice2:
statement2;
case choice-n:
statement-n;
-Conditional operator (?) is also used to check true or false value for given statements syntax for this is:-
Condition ? Expression 1 for condition true : Expression 2 for condition false
Many operators are used to check statements like :-
logical operator:- AND, OR, NOT, XOR.
Comparison operator:- =, <=, >=, !=.
Conditional statements examples can be understand by converse, inverse and contra positive expressions.
If the deer will run then tiger will hunt the deer---conditional.
If the deer won't then the tiger won't hunt the deer---inverse.
If the tiger will hunt the deer then the deer will run---converse.
It the tiger won't hunt the deer then the deer won't run---contra positive.
If p then q conditional
if q then p converse
if p will be negation than negation q inverse
if negation q then negation p contra positive
Logically equivalent will be conditional expression and its contra positive.
In upcoming posts we will discuss about Geometric proofs in Grade XII and Correlation coefficient. Visit our website for information on school education Karnataka
No comments:
Post a Comment