Computer Science, asked by dynamogamer769, 8 months ago

Type the value of c = (val + 550 < 1700)? 200: 400; if: (a) val = 1000 (b) val =1500​

Answers

Answered by Legend42
15

Answer:

c = (val + 550 < 1700)? 200: 400;

c = (val + 550 < 1700)? 200: 400;if: (a) val = 1000 (b) val = 1500

c = (val + 550 < 1700)? 200: 400;if: (a) val = 1000 (b) val = 1500Output

c = (val + 550 < 1700)? 200: 400;if: (a) val = 1000 (b) val = 1500Output(a) 200

c = (val + 550 < 1700)? 200: 400;if: (a) val = 1000 (b) val = 1500Output(a) 200(b) 400

c = (val + 550 < 1700)? 200: 400;if: (a) val = 1000 (b) val = 1500Output(a) 200(b) 400Explanation

c = (val + 550 < 1700)? 200: 400;if: (a) val = 1000 (b) val = 1500Output(a) 200(b) 400ExplanationWhen val = 1000, val + 550 = 1550. As 1550 is less than 1700 so condition of ternary operator is true. Variable c is assigned the value of expression 1 which is 200.

c = (val + 550 < 1700)? 200: 400;if: (a) val = 1000 (b) val = 1500Output(a) 200(b) 400ExplanationWhen val = 1000, val + 550 = 1550. As 1550 is less than 1700 so condition of ternary operator is true. Variable c is assigned the value of expression 1 which is 200.When val = 1500, val + 550 = 2050. As 2050 is greater than 1700 so condition of ternary operator is false. Variable c is assigned the value of expression 2 which is 400

Plzzzzz mark it as branliest

Similar questions