Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given the structure: typedef struct double length; double width; double height;

ID: 3714568 • Letter: G

Question

Given the structure: typedef struct double length; double width; double height; double area; double volume; double slant len; double base_per; ? pyramid; . Using a C command, create an array of 10 pyramids (3 pts) 2. Create a single pyramid using a C command (2 pts): 3. Using printf and scanf, ask the user to enter the length, width and height for the pyramid in #2 (5 pts): 4 Using the values scanned in #3, calculate the volume of the pyramid and store it in the same structure using the equation V (5 pis): 5. Assume that the array of 10 values each has the length, width and height assigned to values in the structure. Create a for loop that will calculate the area of each pyramid in the array using the equation A = lw + 11, + h2 + w|(L)

Explanation / Answer

int main( )
{
//1
pyramid pyramids[10];

//2
pyramid p;

//3
double length,width,height;
printf("Enter length, width and height ");
scanf("%lf%lf%lf",length,width,height);

//4
double V = (length*width*height)/3;
p.volume = V;

//5
int i;
double area;
for(i=0;i<10;i++){
area = pyramids[i].length*pyramids[i].width;
area = area + pyramids[i].length*sqrt((pyramids[i].width*pyramids[i].width)/4 + pyramids[i].height*pyramids[i].height);
area = area + pyramids[i].width*sqrt((pyramids[i].length*pyramids[i].length)/4 + pyramids[i].height*pyramids[i].height);
pyramids[i].area = area;
}
return -1;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote