...

Exercise: Weekday Checker

Now let's practice using the || operator! In the previous lesson, we learned how to check if a day is a weekend. Now let's do the opposite - check if a day is a weekday.

A weekday is any of these five days: Monday, Tuesday, Wednesday, Thursday, or Friday.

Since we need to check if the day is any one of these five options, we'll need to use the || operator multiple times!

Your Task

Write a program that checks if the entered day is a weekday:

  • If it's a weekday (Monday through Friday), print: "It's a weekday - time to work!"
  • If it's not a weekday (Saturday or Sunday), print: "It's not a weekday - enjoy your time off!"

Hint

You'll need to chain multiple || operators together. Think about how you can check for all five weekdays!

Loading...

Output (Console)