No. 027 switch-case

整数値を入力させ、その値が 1 なら “one”、2 なら “two”、3 なら “three”、それ以外なら “others” と表示するプログラムを switch-case 文を使って作成せよ。

実行例

input number: 1

one

input number: 2

two

input number: 3

three

input number: 0

others

このプログラムを通じて、switch-case 文の使い方を学び、条件に応じた処理の選択方法を習得しましょう!