practice_C

Switch Statements

Exercises

  1. Check whether a number is divisible by both 3 and 5.
  2. Check whether an entered number is a perfect square.
  3. Display the season for a month using this mapping: winter (December-February), summer (March-May), monsoon (June-September), and autumn (October-November).
  4. 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.