Switch case

switch case is a branching statement used to perform the action based on available choices, instead of making decisions based on conditions? Using youswitch case can write more clean and optimal code than if else statement.
switch case only works with integer, character and enumeration constants.
In these exercises, we will focus on the use of the statementswitch case. We will learn where to implement the statementswitch case other than a statementif else.



Required knowledge


List of switch case programming exercises

  1. Write a C program to print day of week name using a switch case.
  2. Write a C program print total number of days in a month using a switch case.
  3. Write a C program to check whether an alphabet is a vowel or consonant using a switch case.
  4. Write a C program to find the maximum between two numbers using a switch case.
  5. Write a C program to check whether a number is even or odd using a switch case.
  6. Write a C program to check whether a number is positive, negative or zero using a switch case.
  7. Write a C program to find roots of a quadratic equation using a switch case.
  8. Write a C program to create a Simple Calculator using a switch case.

No comments

Powered by Blogger.