vendredi 1 mai 2015

Convert the program fragment from switch to else if/else?

Stuck on this practice problem.I usually understand these, but this one seems more difficult.

Here is the question in it's entirety, any help would be greatly appreciated.

Convert the program fragment from switch to if/else.

switch (a)  {
 case 5 : c = c + b;
 case 2 : c = c + 2*b;
          break;
 case 3 : c = 7;
          break;
 case 6 : break;
 case 7 : c = c + 9;
          break;
 case 4 :
 case 1 : c *= c;
          break;
 default : c %= 2;
          break;
}

Aucun commentaire:

Enregistrer un commentaire