In: Computer Science
write a java program for area and perimeter of right triangle
//RightTriangleAreaPerimeter.java import java.util.Scanner; public class RightTriangleAreaPerimeter { public static void main(String[] args) { Scanner scan = new Scanner(System.in); double base, height; System.out.print("Enter base of right angle triangle: "); base = scan.nextDouble(); System.out.print("Enter height of right angle triangle: "); height = scan.nextDouble(); double area = (base*height)/2; double perimeter = base+height+Math.sqrt(Math.pow(base,2)+Math.pow(height,2)); System.out.println("Area = "+area); System.out.println("Perimeter = "+perimeter); } }