2. 右側 switch 敘述程式碼可以如何以 if-else
改寫?
(A) if (x==10) y = 'a';
if (x==20 || x==30) y = 'b';
y = 'c';
(B) if (x==10) y = 'a';
else if (x==20 || x==30) y = 'b';
else y = 'c';
(C) if (x==10) y = 'a';
if (x>=20 && x<=30) y = 'b';
y = 'c';
(D) if (x==10) y = 'a';
else if(x>=20 && x<=30) y = 'b';
else y = 'c';