Computer Science, asked by tanisha5karthik, 9 months ago

Rewrite the snippet using Ternary operators:
a) if (a>b) { d = (a-b); else d = (b – a); }
b) if (basic>10000) { tax = 0; else tax = 1000; }
c) if((a+b)>c) { k=15; System.out.println(k); } if((a+b)>c) { k=30; System.out.println(k); }

Answers

Answered by mehermanoj76
6

Answer:

d=(a>b?a-b:b-a)

tax=(basic>10000?0:1000)

((a+b)>c)?{k=15; System.out.println(k);}:{k=30; System.out.println(k);}

Similar questions