C  Switch  statements and its example

program of switch statement
program of switch statement

                            C  Switch  statements

 

Switch statements simulate the use of multiple if statement.The switch statement is probably the single most syntactically awkward and error-prone feature of the C language. Syntax

switch(expression) {
case constant1:
statements 1;
break;
case constant2:
statements 2;
break;
…………………..
default:
statements n;
break;
}

x of c switch statement is

Write a c program to enter any alphabet and check whether alphabet is vowel or consonant using switch case. C program for checking vowels and consonants using switch.

Example:
Input any alphabet: c
Output: It is consonant.

program of switch statement

Fig:C program for checking vowels and consonants using switch

Write a C program to create a simple calculator that performs basic arithmetic operations (add, subtract, multiply and divide) using switch case and functions. The calculator should read two numbers and an operator from user. The calculator should perform operation according to the operator entered.

switch looping statement program

Fig:Write a C program to create a simple calculator

 

We are reached:  what is c switch statement,switch statement,syntax of c switch statement,switch expression,Write a C program to create a simple calculator ,C program for checking vowels and consonants using switch,using case.

Be the first to comment

Leave a Reply

Your email address will not be published.


*