rewrite the following statement using suitable if-else statement: int result = average > 365 ? (500/10) : (300/10) ;
Answers
Answered by
2
Explanation:
variable = Expression1 ? Expression2: Expression3
If operates similarly to that of the if-else statement as in Exression2 is executed if Expression1 is true else Expression3 is executed.
if(Expression1)
{
variable = Expression2;
}
else
{
variable = Expression3;
}
Answer:
if(average>365)
{
int result = 500/10;
}
else
{
int result = 300/10;
}
Similar questions