Ask Question
16 September, 22:43

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.

+2
Answers (1)
  1. 16 September, 23:45
    0
    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");
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Int side1; int side2; / /additional vars as needed /*assume there is code here to initialize these values*/ Two polygons are said to be ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers