C switch Statement.
The switch statement allows us to execute one code block among many alternatives.
You can do the same thing with the if...else..if ladder. However, the syntax of the switch statement is much easier to read and write.
How does the switch statement work?
->The expression is evaluated once and compared with the values of each case label.
->If there is a match, the corresponding statements after the matching label are executed. For example, if the value of the expression is equal to constant2, statements after case constant2: are executed until break is encountered.
->If there is no match, the default statements are executed.
->If we do not use break, all statements after the matching label are executed.
->By the way, the default clause inside the switch statement is optional.Program to create a simple calculator
Put the parts in order to form a sentence. When you think your answer is correct, click on "Check" to check your answer. If you get stuck, click on "Hint" to find out the next correct part.