Switch Case Statements In C language

aimtocode

Switch Case

The switch-case statement causes a particular group of statements to be selected from a group of options. The selection is based upon the current value of the expression which is specified with the SWITCH statement.

The switch statement allows a number of choice. In C, switch statement check the value of given variable or statement against a list of case values and when the match is found a statement-block of the case is executed.

Switch statement is also called as multiway decision statement.

Syntax:

Flowchart:

Example:



Output:

 Enter Number: 5
 friday

 Enter Number: 1
 Monday

 //default case//
 Enter Number From 1 to 7: 8
 Enter days between 1 - 7


Read Also:


aimtocode