Computer Science, asked by parthomsarwade, 11 months ago

using conditional operator write equivalent expression for the following
1) F=0.5 if x=30 otherwise 0
2) Print "Even" if x is an even number otherwise print "Odd"​

Answers

Answered by Ayushpatel237
7

1) using ternary operator..

F=(x=30)?0.5:0

2)you can use ternary operator but for not making it complex..use if else....

if( x %2 == 0 )

{ SOPln(" Even");

}

else

{SOPln( "Odd");

}

Similar questions