Computer Science, asked by maheshkumarvereen, 1 month ago

2. WAP to find the area and perimeter of a right-angled triangle. Take base and perpendicular as
inputs. (Use function arguments)

Answers

Answered by rakeshbirdy
0

Answer:

class triangle

{

public static void main(int p, int b)

{

int area =0;

int perimeter= 0;

area= b*h/2; //area formula for triangle is height X

base X 1/2

int hypo= Math.sqrt((p+b)*(p+b)); //pythagoras theorem

for third side.

perimeter= hypo+b+p; //add all sides for perimeter

System.out.println("Perimeter = " + perimeter);

System.out.println("Area = " + area);

}

}

HOPE IT HELPED!!! PLEASE MARK ME BRAINLIEST!!! THANKS YOU <3

Similar questions