Answer to Question #244362 in C for hello

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



1
Expert's answer
2021-09-29T10:27:10-0400
#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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS