what will be the output of the following condition statement A=10>10?100:200?
Answers
Answered by
4
Answer:
A = 200
Explanation:
This operator is known as a ternary operator .
Ternary operator has both assignment and relational expressions.
A will be 100 if the condition is true and A will be 200 if false .
Here evidently 10 > 10 is false and hence the output will be A = 200 .
In simple terms we can write the code as :
if ( 10 > 10 )
{
A = 100 ;
}
else
{
A = 200 ;
}
This is the converted if-else statement .
Similar questions