/**
 * A carpenter wants to count the number of nails hammered using a certain number of hammers.
 * Given the list of nails and the number of hammers, count the total number of nails hammered.
 *
 * @param nails A list of integers representing the nails hammered by each hammer.
 * @param numHammers The number of hammers used.
 * @return The total count of nails hammered.
 *
 * Example:
 * countNails(listOf(10, 15, 8, 12, 9), 3) => 39
 * countNails(listOf(5, 6, 3, 7, 4, 5), 2) => 30
 */
fun countNails(nails: List<Int>, numHammers: Int): Int {

    var totalCount = 0

    for (i in 0 until numHammers) {
        val count = nails[i]
        totalCount += count
    }

    return totalCount
}
/**
 * A carpenter wants to count the number of nails hammered using a certain number of hammers.
 * Given the list of nails and the number of hammers, count the total number of nails hammered.
 *
 * @param nails A list of integers representing the nails hammered by each hammer.
 * @param numHammers The number of hammers used.
 * @return The total count of nails hammered.
 *
 * Example:
 * countNails(listOf(10, 15, 8, 12, 9), 3) => 39
 * countNails(listOf(5, 6, 3, 7, 4, 5), 2) => 30
 */
fun countNails(nails: List<Int>, numHammers: Int): Int {
/**
 * A carpenter wants to count the number of nails hammered using a certain number of hammers.
 * Given the list of nails and the number of hammers, count the total number of nails hammered.
 *
 * @param nails A list of integers representing the nails hammered by each hammer.
 * @param numHammers The number of hammers used.
 * @return The total count of nails hammered.
 *
 * Example:
 * countNails(listOf(10, 15, 8, 12, 9), 3) => 39
 * countNails(listOf(5, 6, 3, 7, 4, 5), 2) => 30
 */
fun countNails(nails: List<Int>, numHammers: Int): Int {

    var totalCount = 0

    for (i in 0 until numHammers) {
        val count = nails[i]
        totalCount += count
    }

    return totalCount
}