Computer Science, asked by Ashjin, 3 months ago

Rewrite the following using ternary ooperator

Attachments:

Answers

Answered by omkarjadhav143
0

Answer:

tax

Explanation:

tax is 0.1

=100000÷0.1

=1000000

Answered by Oreki
1

Answer:

   tax = (income < 1_00_000) ? 0 : 0.1 * income;

Ternary (or Conditional) Operator

It is a cut short notation of simple conditional statements.

When a condition is evaluated to true the statement after the ? is executed otherwise the statement after the : gets executed.

  Syntax -

      test-condition ? statement1 : statement2;

         So, if the test-condition is evaluated to true, statement1 gets executed otherwise statement2 gets executed.

Similar questions