Computer Science, asked by MalayaDhal, 7 months ago

please solve this.............​

Attachments:

Answers

Answered by anindyaadhikari13
1

\star\:\:\:\bf\large\underline\blue{Question:-}

  • Rewrite the given code using ternary operator.

\star\:\:\:\bf\large\underline\blue{Answer:-}

Given code:-

int a=100;

if(a>99)

num="Three digit";

else

num="Two digit";

This can be written using ternary operator as

int a=100;

num=(a>99)?"Three digit": "Two digit";

The ternary operator contains three operands.

Similar questions