Documente Academic
Documente Profesional
Documente Cultură
switch (number) {
case 1:
printf(One!!\n); This program reads a number from
break; the user and print out the string
case 2: equivalent for 1, 2 or 3.
printf(Two!!\n); If the value being keyed in is other
break; than 1,2 or 3, the default statement
case 3: will be executed where the
printf(Three!!\n); statement Others will be printed
break;
out.
default:
printf(Others\n);
break;
}
Output:
a = 0
a = 1
a = 3
a = 4