/**
 * This exercise aims to test your understanding of both representing complex numbers in Kotlin
 * and using nested ternary operators. Your task is to complete the code to calculate the square of
 * a given complex number.
 *
 * The function takes two arguments: real and imag, which represent the real and imaginary parts
 * of a complex number, respectively.
 *
 * Your goal is to complete the code so that it calculates the square of the complex number and
 * returns it.
 *
 * Remember, to square a complex number, you need to multiply it by itself.
 *
 * Good luck!
 */
fun calculateComplexNumber(real: Int, imag: Int): Pair<Int, Int> {

    val result = if (real != 0) {
        Pair(real * real + imag * imag,  // Square of the real part
             2 * real * imag)  // Square of the imaginary part
    } else {
        Pair(-imag * imag,  // Square of the real part when real part is 0
             0)  // Square of the imaginary part when real part is 0
    }

    return result
}
/**
 * This exercise aims to test your understanding of both representing complex numbers in Kotlin
 * and using nested ternary operators. Your task is to complete the code to calculate the square of
 * a given complex number.
 *
 * The function takes two arguments: real and imag, which represent the real and imaginary parts
 * of a complex number, respectively.
 *
 * Your goal is to complete the code so that it calculates the square of the complex number and
 * returns it.
 *
 * Remember, to square a complex number, you need to multiply it by itself.
 *
 * Good luck!
 */
fun calculateComplexNumber(real: Int, imag: Int): Pair<Int, Int> {
/**
 * This exercise aims to test your understanding of both representing complex numbers in Kotlin
 * and using nested ternary operators. Your task is to complete the code to calculate the square of
 * a given complex number.
 *
 * The function takes two arguments: real and imag, which represent the real and imaginary parts
 * of a complex number, respectively.
 *
 * Your goal is to complete the code so that it calculates the square of the complex number and
 * returns it.
 *
 * Remember, to square a complex number, you need to multiply it by itself.
 *
 * Good luck!
 */
fun calculateComplexNumber(real: Int, imag: Int): Pair<Int, Int> {

    val result = if (real != 0) {
        Pair(real * real + imag * imag,  // Square of the real part
             2 * real * imag)  // Square of the imaginary part
    } else {
        Pair(-imag * imag,  // Square of the real part when real part is 0
             0)  // Square of the imaginary part when real part is 0
    }

    return result
}