1. Write a program that calculates the area and perimeter of a rectangle. The program should include the following function. Do not modify the function prototype.

void area_perimeter(double width, double length, double *area, double *perimeter);

The function takes two parameters of double type for the width and length of the rectangle. The area parameter points to a variable in which the function will store the area of the rectangle. The perimeter parameter points to a variable in which the function will store the perimeter of the rectangle. The main function should ask the user to enter the width and length of the rectangle and call the area_perimeter function to calculate the area and perimeter. The main function should contain the printf statements that display the result.

2. Write a program that computes the sum and difference of two complex numbers. In the function, r represents the real component and i represents the imaginary component. The program should include the following function. Do not modify the function prototype.

Complete the function that reads in two complex numbers.

void sum_diff(double *r3, double *i3, double *r4, double *i4);

The function should prompt for the user to enter the real component and imaginary component of the first complex number and the second complex number and store the sum of the two complex number in the variables pointed by r3, i3, and store the difference of the two complex number in the variables pointed r4, i4, respectively. The main function should call the sum_diff function and contain the printf statements that display the result with three decimal digits.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.