/* Shape Properties (15 points) Write a complete C program that calculates and prints on the screen the area and the outer perimeter of the figure shown below (an equilateral triangle with a rectangular cut out). The program must ask the user to enter the coordinates of the l ower left corner (X1, Y1) and the upper corner of the triangle (X2, Y2) from which the side (S) can be calculated. The program must also ask for the length(L) and width(W) of the rectangle. You can assume that the user will enter the points in the right order (no error checking). (x2,y2) /\ / \ / \ / \ S / \ S / \ / ----- \ / | | W \ / ----- \ / L \ / \ *---------------------- (x1,y1) S */ #include #include #include int main() { float x1, y1, x2, y2; float L, W; printf("Enter x1: "); scanf("%f", &x1); printf("Enter y1: "); scanf("%f", &y1); printf("Enter x2: "); scanf("%f", &x2); printf("Enter y2: "); scanf("%f", &y2); printf("Enter L: "); scanf("%f", &L); printf("Enter W: "); scanf("%f", &W); float s = sqrt ((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)); float h = sqrt(s*s - (s/2)*(s/2)); float triangle_area = (s * h) /2.0; printf("The area of the triangle is = %g\n\n", triangle_area); float area = triangle_area - L*W; float perimeter = 3*s; printf("The perimeter is %f\n", perimeter); printf("The area is %f\n\n", area); system("pause"); }