------------------------------------------------------------------------------
MC logo
Switch Using Break
[^] Code Examples
------------------------------------------------------------------------------
<<Switch switch2.c Break and Continue>>
#include <stdio.h>

/* Switch with break. */

int main()
{
        int m;

        scanf("%d", &m);

        switch(m)
        {
        case 1: 
                printf("1\n");
                break;
        case 2:
                printf("2\n");
                break;
        case 3: 
                printf("3\n");
                break;
        default: 
                printf("Otherwise\n");
        }
}
Reading: Ch. 8
<<Switch Break and Continue>>