Computer Science, asked by sharPal3947, 10 months ago

Write the following if...else statement using the conditional operators
If (x == 100)
a = "x is 100"
else
a = "x is not 100"

Answers

Answered by anishasa
5

Explanation:

Syntax : (Condition? true_value: false_value);

(x== 100 ? "x is 100" : "x is not 100");

Answered by AskewTronics
1

a=x==100?"x is 100":"x is not 100"; is the answer for the above question

Explanation:

  • The conditional or ternary operator is an operator that is used to check the condition. It has three phases which are as follows:-
  1. The first phase is used to check the condition.
  2. The second phase is executed if the condition will true.
  3. The third phase is executed if the condition is false.
  • One variable is also used to hold the value of the condition. The above question has an if and else statement which checks the value of an x variable to be equal to 100 or not.
  • So the above expression also holds the condition to check the value to be equal to 100 or not.

Learn More:

  • Conditional operator: https://brainly.in/question/10641825
Similar questions