Computer Science, asked by Dhawal62, 1 month ago

Rewrite the following using ternary operator:
If the value of 'a' is 100 then assign 55 to 'b' otherwise assign 26 to 'b.​

Answers

Answered by BrainlyProgrammer
4

Question:-

  • Rewrite the following using ternary operator :
  • If the value of 'a' is 100 then assign 55 to 'b' otherwise assign 26 to 'b.

Answer:-

b= (a==100)?55:26;

How will it work?

  • The control will assign 55 to b only when a is 100 other wise it will assign 26 to b
Similar questions