/**
 * Given a list of temperature readings and a maximum temperature, this function
 * calculates the number of consecutive readings that are within the normal range
 * (between 36.5 and 37.5 degrees Celsius). The function stops counting if it encounters
 * a reading outside the normal range or if it reaches the specified maximum temperature.
 *
 * @param temperatureReadings A list of recorded temperature readings (float values).
 * @param maxTemp The maximum temperature at which counting should stop.
 * @return The number of consecutive temperature readings within the normal range.
 */
fun calculateNormalRange(temperatureReadings: List<Float>, maxTemp: Float): Int {

    var count = 0
    var i = 0
    while (i < temperatureReadings.size) {
        val temperature = temperatureReadings[i]
        if (temperature < 36.5 || temperature > 37.5) {
            break
        }

        count++
        i++

        if (temperature >= maxTemp) {
            break
        }
    }

    return count
}
/**
 * Given a list of temperature readings and a maximum temperature, this function
 * calculates the number of consecutive readings that are within the normal range
 * (between 36.5 and 37.5 degrees Celsius). The function stops counting if it encounters
 * a reading outside the normal range or if it reaches the specified maximum temperature.
 *
 * @param temperatureReadings A list of recorded temperature readings (float values).
 * @param maxTemp The maximum temperature at which counting should stop.
 * @return The number of consecutive temperature readings within the normal range.
 */
fun calculateNormalRange(temperatureReadings: List<Float>, maxTemp: Float): Int {
/**
 * Given a list of temperature readings and a maximum temperature, this function
 * calculates the number of consecutive readings that are within the normal range
 * (between 36.5 and 37.5 degrees Celsius). The function stops counting if it encounters
 * a reading outside the normal range or if it reaches the specified maximum temperature.
 *
 * @param temperatureReadings A list of recorded temperature readings (float values).
 * @param maxTemp The maximum temperature at which counting should stop.
 * @return The number of consecutive temperature readings within the normal range.
 */
fun calculateNormalRange(temperatureReadings: List<Float>, maxTemp: Float): Int {

    var count = 0
    var i = 0
    while (i < temperatureReadings.size) {
        val temperature = temperatureReadings[i]
        if (temperature < 36.5 || temperature > 37.5) {
            break
        }

        count++
        i++

        if (temperature >= maxTemp) {
            break
        }
    }

    return count
}