switch case

switch case :

                                   It provides a multi way branching. It allows user to select any one of the several alternatives, depending upon the value of an expression. The value of expression enclosed with in the parentheses. Depending upon the value of expression,the control is transferred to a particular case and statements executed according to the case value.The syntax of switch statement is

SYNTAX :
switch(expression)
{
        case  value 1:    statement 1;
                                    break;

        case  value 2:    statement 2;
                                    break;

        case  value 3:    statement 3;
                                    break;

        case  default:    statement n;
                                    break;
}

EXAMPLE :
#include<stdio.h>
void main( )
{
int num;
printf("Hello user, Enter a number");
scanf("%d",&num); // Collects the number from user
switch(num)
{
case  1:  printf("
UNITED STATES"); 
               break;
case  2:  printf("
SPAIN");
               break;
case  3:  printf("
INDIA");
default:  printf("
WRONG ENTRY");
}
}
OUTPUT :
based on your number.............