In C programming language, sometimes we need to check multiple conditions. At that time we can you switch...case statement.
Syntax:
switch(choice)
{
case value1:
statement-1;
break;
case value2:
statement-2;
break;
case value3:
statement-3;
break;
case value4:
statement-4;
break;
.
.
.
.
.
case value-n:
statement-n;
break;
default:
default statement;
}
Example: A C Program to add, subtract, multiply, divide two values using switch...case statement.
Syntax:
switch(choice)
{
case value1:
statement-1;
break;
case value2:
statement-2;
break;
case value3:
statement-3;
break;
case value4:
statement-4;
break;
.
.
.
.
.
case value-n:
statement-n;
break;
default:
default statement;
}
Example: A C Program to add, subtract, multiply, divide two values using switch...case statement.