Phuocdao / Kain

C study
0 stars 0 forks source link

Homework 13 #13

Open Phuocdao opened 1 year ago

Phuocdao commented 1 year ago

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; }