...

Exercise: Heart Rate Monitor

Let's practice the || operator with number comparisons! In this exercise, we'll create a heart rate monitor that checks for abnormal readings.

We want to alert when the heart rate is either too low or too high:

  • Too low: Below 60 beats per minute
  • Too high: Above 100 beats per minute

Your Task

Write a program that:

  • Takes a patient's heart rate as input
  • If the heart rate is below 60 OR above 100, prints: "Abnormal heart rate - consult a doctor!"
  • If the heart rate is between 60 and 100 (inclusive), print: "Normal heart rate."

Hint

You'll need to use the || operator to combine two separate conditions: one for low heart rates and one for high heart rates.

Loading...

Output (Console)