C Programming Language @ little drops @ thiyagaraaj.com




Switch Case Statement Example Program In C Programming Language


Syntax:

switch ( <variable> ) {
case value1:
  //Code Here
  break;
case value2:
  //Code Here
  break;
...
default:
  Code to execute for not match case
  break;
}

Example Program For Switch

/*  Example Program For Switch Case In C Programming Language
    little drops @ thiyagaraaj.com

    Coded By:THIYAGARAAJ MP             */

// Header Files
#include<stdio.h>
#include<conio.h>

//Main Function
int main()
{

     // Variable Declaration
     char ch;

     //Get Input Value
     printf("Enter the Vowel (In Capital Letter):");
     scanf("%c",&ch);

     //Switch Case Check

     switch( ch )
     {
        case 'A' : printf( "Your Character Is A\n" );
                   break;
        case 'E' : printf( "Your Character Is E\n" );
                   break;
        case 'I' : printf( "Your Character Is I\n" );
                   break;
        case 'O' : printf( "Your Character Is O\n" );
                   break;
        case 'U' : printf( "Your Character Is U\n" );
                   break;
        default  : printf( "Your Character is Not Vowel.Otherwise Not a Capital Letter\n" );
                   break;
     }

     // Wait For Output Screen
     getch();

     //Main Function return Statement
     return 0;
}

Sample Output:

Enter the Vowel (In Capital Letter):A
Your Character Is A

Enter the Vowel (In Capital Letter):O
Your Character Is O

Enter the Vowel (In Capital Letter):h
Your Character is Not Vowel.Or Not a Capital Letter




 

News Android Apps

USA,UK,India and Technology News Android App

USA UK TECH INDIA

Programming Android Apps

Java,Java Programming,Unix and Linux Guide

JAVA UNIX UBUNTU

More Programming

Easy Concepts and More Programming

C++ view more
 

Information and Get All