C - Write program to fall through switch case statements

Requirements

Use switch case statements fall through so that both upper- and lowercase letters are evaluated in the switch-case structure.

Demo

#include <stdio.h>

int main()/* ww w . j  av  a  2s.  com*/
{
    char choice;

    puts("Meal Plans:");
    puts("A - Breakfast, Lunch, and Dinner");
    puts("B - Lunch and Dinner only");
    puts("C - Dinner only");
    printf("Your choice: ");
    scanf("%c",&choice);

    printf("You've opted for ");
    switch(choice)
    {
        case 'A':
        case 'a':
            printf("Breakfast, ");
        case 'B':
        case 'b':
            printf("Lunch and ");
        case 'C':
        case 'c':
            printf("Dinner ");
        default:
            printf("as your meal plan.\n");
    }
    return(0);
}

Result

Related Exercise