How to use switch control statement in C language

Switch Statement

On this page

Switch Statement

Program to use Switch Control Ststement in C Language

#include <stdio.h>
int main()
{
  int choice;
  printf("Enter your choice : ");
  scanf("%d", &choice);
  switch (choice)
  {
  case 1:
      printf("First\n");
  case 2:
      printf("Second\n");
  case 3:
      printf("Third\n");
  default:
      printf("Wrong choice\n");
  }
  return 0;
}

Output

Enter your choice : 1
First
Second
Third
Wrong choice