Switch Statements
Exercises
- Check whether a number is divisible by both 3 and 5.
- Check whether an entered number is a perfect square.
- Display the season for a month using this mapping: winter (December-February), summer (March-May), monsoon (June-September), and autumn (October-November).
- Create a menu-driven area calculator for a circle, square, rectangle, and triangle using
switch.
Concepts practiced
switch, case, break, menus, and validation.
Click here for explanation and solution.