Computer Science, asked by maria6985, 1 year ago

Rewrite the snippet using ternary operation
if(a>b)
d=(a-b);
else
d=(b-a);

Answers

Answered by bhavesh2890
1
it maybe n the ofsm nu .
Answered by nalinipriyadharshini
2

Answer:SYNTAX

variable=condition?exp1:exp2

Explanation:

VARIABLE=d

condition=a>b

exp1=a-b(if true)

exp2=b-a(if false)

so in terms of ternary operator

answer is

d = a>b? a-b : b-a;

Similar questions