Computer Science, asked by divyanshi261, 1 year ago

what will be output when :a) Val =500 b) Val =1500 Int Val, sum, n=550.sum=n+val >1750?400:200System.out.println(sum),

Answers

Answered by ShadowMaster2510
4
Ans :- (a) 200 (b) 400


a) Val = 500

int Val=500, sum,n=550;
sum = n+val>1750?400:200 ....(line 2)
sum = 200

{
Explaination

n = 550, Val=500,n+Val=1050
n+Val>1750 (false)
sum= 200 because line 2 contains ternary
operator.

In that case before question mark is the
condition ( n+val>1750) and if condition is
true the value after ? will be use(400) else
200 will be use.
}
Answered by ARYANAS131
2

200 will be used ok

PLEASE MARK AS BRAINLIST

Similar questions