Computer Science, asked by izabelJustin, 7 months ago

answer this, plsssssss........ ​

Attachments:

Answers

Answered by anindyaadhikari13
2

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

  • Write the alternative coding for the following program so that it avoids number of comparison for the following program code

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

The above code can be written in following manner.

switch(s)

{

case 1: System.out.println("One.");

break;

case 2: System.out.println("Two.");

break;

case 3: System.out.println("Three");

break;

case 4: System.out.println("Four.");

break;

case 5: System.out.println("Five.");

break;

default: System.out.println("Invalid Choice. ");

}

Similar questions