Write a C program that utilizes the ComplexNumber data type defined below, ----- Start of Data Type Definition ----- typedef struct _ComplexNumber { double real; // real part double imag; // imaginary part } ComplexNumber; ----- End of Data Type Definition ----- The following behavior should be implemented: 1. Declare three ComplexNumber variables 2. Initialize the first complex variable as follows: ---->> real part = 0.5, imaginary part = -0.5 ---->> Print the initialization info on the screen 3. Initialize the second complex variable as follows: ---->> real part = -1.75, imaginary part = 0.5 ---->> Print the initialization info on the screen
Write a C program that utilizes the ComplexNumber data type defined below,
----- Start of Data Type Definition -----
typedef struct _ComplexNumber {
double real; // real part
double imag; // imaginary part
} ComplexNumber;
----- End of Data Type Definition -----
The following behavior should be implemented:
1. Declare three ComplexNumber variables
2. Initialize the first complex variable as follows:
---->> real part = 0.5, imaginary part = -0.5
---->> Print the initialization info on the screen
3. Initialize the second complex variable as follows:
---->> real part = -1.75, imaginary part = 0.5
---->> Print the initialization info on the screen
4. Calculate the sum of the first and second complex variables
---->> Store the results in the third complex variable
---->> Print the results on the screen
5. Calculate the difference, i.e., first complex number minus second complex number
---->> Store the results in the third complex variable
---->> Print the results on the screen
6. Calculate the product of the first and second complex variables
---->> Store the results in the third complex variable
---->> Print the results on the screen
5. Calculate the quotient, i.e., first complex number divided by the second complex number
---->> Store the results in the third complex variable
---->> Print the results on the screen
6. Program exits.
Refer to the figure below for the output of the program on the screen / console.
Step by step
Solved in 5 steps with 2 images
Please continue the codes of the remaining items (4-6).