Write a function using C language for finding the magnitude orphase of an imaginary number. The function should have astructure input parameter and an integer input parameter. Thestructure input parameter will contain two doubles, real and imag,that contain the real and imaginary part of the number. The integer input will be a flag to determine if the magnitude orphase is to be calculated. A zero will represent that themagnitude is desired, otherwise the phase should becalculated. The phase should be returned as short integerthat takes a value between 0 and 359. The magnitude should bereturned as a double. A union should be used so that themagnitude or phase may be returned under their respective type.