/**
 * A civil engineer wants to calculate the amount of reinforcement steel required for a concrete slab.
 * The engineer knows the diameter of the reinforcement bars, the spacing between them, the width of the
 * slab, and the length of the slab. Complete the code below to calculate the total length of steel bars
 * required for the slab.
 */
fun calculateSlabReinforcement(rebarDiameter: Int, rebarSpacing: Int, slabWidth: Int, slabLength: Int): Int {

    // Calculate the number of bars required in each direction
    val numBarsWidth = slabWidth / rebarSpacing + 1
    val numBarsLength = slabLength / rebarSpacing + 1

    // Calculate the total length of steel bars required
    var totalLength = 0

    // Continue the below code block multiple times to calculate the length of steel bars in each direction
    for (i in 0 until numBarsWidth) {
        for (j in 0 until numBarsLength) {
            // Calculate the length of steel bars for each intersection point
            val barLength = (slabWidth - (rebarSpacing * i)) + (slabLength - (rebarSpacing * j))
            totalLength += barLength
        }
    }

    return totalLength
}
/**
 * A civil engineer wants to calculate the amount of reinforcement steel required for a concrete slab.
 * The engineer knows the diameter of the reinforcement bars, the spacing between them, the width of the
 * slab, and the length of the slab. Complete the code below to calculate the total length of steel bars
 * required for the slab.
 */
fun calculateSlabReinforcement(rebarDiameter: Int, rebarSpacing: Int, slabWidth: Int, slabLength: Int): Int {
/**
 * A civil engineer wants to calculate the amount of reinforcement steel required for a concrete slab.
 * The engineer knows the diameter of the reinforcement bars, the spacing between them, the width of the
 * slab, and the length of the slab. Complete the code below to calculate the total length of steel bars
 * required for the slab.
 */
fun calculateSlabReinforcement(rebarDiameter: Int, rebarSpacing: Int, slabWidth: Int, slabLength: Int): Int {

    // Calculate the number of bars required in each direction
    val numBarsWidth = slabWidth / rebarSpacing + 1
    val numBarsLength = slabLength / rebarSpacing + 1

    // Calculate the total length of steel bars required
    var totalLength = 0

    // Continue the below code block multiple times to calculate the length of steel bars in each direction
    for (i in 0 until numBarsWidth) {
        for (j in 0 until numBarsLength) {
            // Calculate the length of steel bars for each intersection point
            val barLength = (slabWidth - (rebarSpacing * i)) + (slabLength - (rebarSpacing * j))
            totalLength += barLength
        }
    }

    return totalLength
}