Computer Science, asked by kumarananya, 10 months ago

write a program in java to calculate the area, perimeter and hypotenuse of a right angled triangle as per the user's choice.
Hypotenuse =
 \sqrt{p { }^{2} }  +  \sqrt{b { }^{2} }
Area of triangle= 1/2*base*height
Perimeter = sum of all sides
( use switch case )

Answers

Answered by ItzAngelSnowflakes
9

Answer:

hey here is ur answer

Explanation:

// Java Program to find Area of a Right Angled Triangle Example

package Area;

import java.util.Scanner;

public class AreaOfRightTriangle {

private static Scanner sc;

public static void main(String[] args) {

double width, height, c, Area, Perimeter;

sc = new Scanner(System.in);

System.out.println("\n Please Enter the Width of a Right Angled Triangle: ");

width = sc.nextDouble();

System.out.println("\n Please Enter the Height of a Right Angled Triangle: ");

height = sc.nextDouble();

Area = 0.5 * width * height;

c = Math.sqrt((width * width) + (height * height));

Perimeter = width + height + c;

System.out.format("\n The Area of a Right Angled Triangle = %.2f\n",Area);

System.out.format("\n The Other side of a Right Angled Triangle is: %.2f\n",c);

System.out.format("\n The Perimeter of a Right Angled Triangle = %.2f\n", Perimeter);

}

}

hope this helps u plz mark me as brainlist

Answered by shobhakandha
2

program in java to calculate area is hypotenuse

Similar questions