Question #244362

Create a c structure to represent a rectangle with width and height. Create a rectangle object and find the perimeter of the rectangle



Expert's answer

#include <stdio.h>

typedef struct {
  int width;
  int height;
} Rect;


int main()
{
  Rect rect;
  rect.width = 10;
  rect.height = 20;
  printf("Perimeter: %d\n", (rect.width + rect.height) * 2);
  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS