Challenge: Writing a switch Statement

Solve the challenge to check your understanding of writing conditional logic using switch statements.

Task 1

Requirements

Given the following unfinished switch statements in C++, complete the missing code logic so that "Multiple of 5" is printed when num is divisible by 5, and "Not a multiple of 5" is printed otherwise.

Instructions

  • Read the unfinished switch statements carefully and identify the missing code logic.
  • Write down your code logic to complete the switch statements based on the requirements given above.
  • The value for num can be any valid positive integer value.

Sample inputs and outputs

  • If num is 10, the code should output "Multiple of 5".
  • If num is 23, the code should output "Not a multiple of 5".

Get hands-on with 1200+ tech skills courses.