Computer Science, asked by dhirajkumarsingh615, 11 months ago

Rewrite the following using ternary operator.if(p>5000) d=p*5/100;else d=2*p/10;


Answers

Answered by anishasa
91

Answer:

Ternary Operator

Syntax:

variable = Expression1 ? Expression2:Expression3;

Expression2 is executed if Expression1 is true

if the Expression1 is false Expression3 executes

d=(p>5000)?(p*5/100) : (2*p/10);

Similar questions