/**
 * A function that calculates the total distance covered by an athlete in a triathlon.
 *
 * The athlete starts with running and then continues with swimming.
 * If the running distance is greater than the swimming distance, the athlete will run until they reach a distance equal
 * to the swimming distance, and if not, the athlete will swim until they reach a distance equal to the running
 * distance. If the running distance and swimming distance are equal, the athlete will run first.
 *
 * @param runningDistance The distance covered by the athlete while running.
 * @param swimmingDistance The distance covered by the athlete while swimming.
 * @return The total distance covered by the athlete in the triathlon.
 */
fun calculateTotalDistance(runningDistance: Float, swimmingDistance: Float): Float {

    var totalDistance: Float

    if (runningDistance > swimmingDistance) {
        totalDistance = runningDistance
        while (swimmingDistance < totalDistance) {
            totalDistance += runningDistance
        }
    } else {
        totalDistance = swimmingDistance
        while (runningDistance < totalDistance) {
            totalDistance += swimmingDistance
        }
    }

    return totalDistance
}
/**
 * A function that calculates the total distance covered by an athlete in a triathlon.
 *
 * The athlete starts with running and then continues with swimming.
 * If the running distance is greater than the swimming distance, the athlete will run until they reach a distance equal
 * to the swimming distance, and if not, the athlete will swim until they reach a distance equal to the running
 * distance. If the running distance and swimming distance are equal, the athlete will run first.
 *
 * @param runningDistance The distance covered by the athlete while running.
 * @param swimmingDistance The distance covered by the athlete while swimming.
 * @return The total distance covered by the athlete in the triathlon.
 */
fun calculateTotalDistance(runningDistance: Float, swimmingDistance: Float): Float {
/**
 * A function that calculates the total distance covered by an athlete in a triathlon.
 *
 * The athlete starts with running and then continues with swimming.
 * If the running distance is greater than the swimming distance, the athlete will run until they reach a distance equal
 * to the swimming distance, and if not, the athlete will swim until they reach a distance equal to the running
 * distance. If the running distance and swimming distance are equal, the athlete will run first.
 *
 * @param runningDistance The distance covered by the athlete while running.
 * @param swimmingDistance The distance covered by the athlete while swimming.
 * @return The total distance covered by the athlete in the triathlon.
 */
fun calculateTotalDistance(runningDistance: Float, swimmingDistance: Float): Float {

    var totalDistance: Float

    if (runningDistance > swimmingDistance) {
        totalDistance = runningDistance
        while (swimmingDistance < totalDistance) {
            totalDistance += runningDistance
        }
    } else {
        totalDistance = swimmingDistance
        while (runningDistance < totalDistance) {
            totalDistance += swimmingDistance
        }
    }

    return totalDistance
}