Computer Science, asked by mansuraahmed01, 2 months ago

Predict the output of the following snippets. (2)

val = 1600;

int val, sum, n=550;

sum=n+val>1750?400:200;

System.out.println(sum);

Answers

Answered by BrainlyProgrammer
1

Question:-

  • To find the output of the following snippet

int val = 1600;

int sum, n=550;

sum=n+val>1750?400:200;

System.out.println(sum);

_____________________

Output:-

400

_______________________

Answer with Explaination:-

Initially, val =1600 and n=550

sum=n+val>1750?400:200;

n+val=1600+550=2150

So, 2150 >1750.....True

So,sum will get 400

Hence the correct output is 400.

Similar questions