# Int side1; int side2; //additional vars as needed /*assume there is code here to initialize these values*/

Int side1;
int side2; //additional vars as needed
/*assume there is code here to initialize these values*/
two polygons are said to be similar if their corresponding angles are the same or if each pair of corresponding sides has the same ratio. write the code to test if two rectangles are similar when the length and width of each are provided as integer values.
if the rectangles have lengths of 10 and 8, the ratio would be 1.25.

## This Post Has 3 Comments

1. Expert says:

2. Expert says:

Mouse and keyboard and software password data and the field codes

3. jeff6284 says:

int width_A, width_B, len_A, len_B;

float rw, rl;

rw = (float)(width_A/width_B);

rl = (float)(len_A/len_B);

if(rw == rl)

printf("They are similar");

else

printf("They are not similar");

Explanation:

The width of the first triangle i call width_A.

The width of the second triangle i call width_B.

The length of the first triangle i call len_A.

The length of the second triangle i call len_B.

The ratio of the width i call rw.

The ratio of the length i call rl.

If rw=rl, the retangles are similar. Otherwise, they are not.

The code is:

int width_A, width_B, len_A, len_B;

float rw, rl;

rw = (float)(width_A/width_B);

rl = (float)(len_A/len_B);

if(rw == rl)

printf("They are similar");

else

printf("They are not similar");