Day Switch in C
Level 3145 keystrokes
Uses switch statement to print day name based on integer value.
C code
// 3 stands for Wednesday1int day = 3;// Jump straight to the case whose label equals day2switch (day) { // Each case ends with break so that only one name is printed3 case 1: printf("Mon"); break;4 case 2: printf("Tue"); break; // This case matches and prints Wed5 case 3: printf("Wed"); break; // Used for any other value; as the last label it needs no break6 default: printf("Other");7}Output
Wed
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this C code and how often they appear.
;× 8"× 8(× 5)× 5:× 4{× 1}× 1=× 1