/**
 * This function takes two floating-point numbers representing the real and imaginary parts of a complex number,
 * and returns a string representing the complex number in the form 'a + bi', where 'a' is the real part and 'b'i is the imaginary part.
 */
fun representComplexNumber(realPart: Float, imaginaryPart: Float): String {

    // Convert the real and imaginary parts to strings
    val realStr = realPart.toString()
    val imaginaryStr = imaginaryPart.toString()

    // Handle the case where imaginary part is zero
    if (imaginaryPart == 0f) {
        return realStr
    }

    // Handle the case where real part is zero
    if (realPart == 0f) {
        return "$imaginaryStr i"
    }

    // Form the complex number representation
    return if (imaginaryPart > 0) {
        "$realStr + $imaginaryStr i"
    } else {
        "$realStr - ${imaginaryStr.substring(1)} i"
    }
}
/**
 * This function takes two floating-point numbers representing the real and imaginary parts of a complex number,
 * and returns a string representing the complex number in the form 'a + bi', where 'a' is the real part and 'b'i is the imaginary part.
 */
fun representComplexNumber(realPart: Float, imaginaryPart: Float): String {
/**
 * This function takes two floating-point numbers representing the real and imaginary parts of a complex number,
 * and returns a string representing the complex number in the form 'a + bi', where 'a' is the real part and 'b'i is the imaginary part.
 */
fun representComplexNumber(realPart: Float, imaginaryPart: Float): String {

    // Convert the real and imaginary parts to strings
    val realStr = realPart.toString()
    val imaginaryStr = imaginaryPart.toString()

    // Handle the case where imaginary part is zero
    if (imaginaryPart == 0f) {
        return realStr
    }

    // Handle the case where real part is zero
    if (realPart == 0f) {
        return "$imaginaryStr i"
    }

    // Form the complex number representation
    return if (imaginaryPart > 0) {
        "$realStr + $imaginaryStr i"
    } else {
        "$realStr - ${imaginaryStr.substring(1)} i"
    }
}