A rectangle contains a square and a rectangle. Enter the length and width of the main rectangle, knowing the side of the inner square is equal to the width of the main rectangle. Calculate the area of the rectangle contained inside.
include
int main()
{
int length, width, square, mrectangle;
//mrectangle: main rectangle
printf ("Enter a number of length: "); scanf ("%d", &length);
printf ("\nEnter a number of width: "); scanf ("%d", &width);
mrectangle = length width;
square = widthwidth;
printf ("\nThe area of main rectangle = %d", mrectangle);
printf ("\nThe area of square = %d", square);
printf ("\nThe area of rectangle = %d", mrectangle - square);
return 0;
}
A rectangle contains a square and a rectangle. Enter the length and width of the main rectangle, knowing the side of the inner square is equal to the width of the main rectangle. Calculate the area of the rectangle contained inside.
include
int main() { int length, width, square, mrectangle; //mrectangle: main rectangle
printf ("Enter a number of length: "); scanf ("%d", &length); printf ("\nEnter a number of width: "); scanf ("%d", &width);
mrectangle = length width; square = widthwidth;
printf ("\nThe area of main rectangle = %d", mrectangle); printf ("\nThe area of square = %d", square);
printf ("\nThe area of rectangle = %d", mrectangle - square); return 0; }