120k views
3 votes
Write a function that compute the perimeter and area of a right triangle when given the length of the two sides

a and b.

User Reifocs
by
8.2k points

1 Answer

4 votes

Final answer:

The perimeter of a right triangle is calculated by adding the lengths of all three sides, while the area is calculated using the formula (1/2) * base * height.

Step-by-step explanation:

The formula for the perimeter of a right triangle is given by:

perimeter = a + b + c

And the formula for the area of a right triangle is given by:

area = (1/2) * a * b

Given the length of the two sides, a and b, you can use these formulas to calculate the perimeter and area of the right triangle.

User Turgs
by
7.5k points