program that finds the area of a right triangle in java code example
Example: Java program to find area of triangle
import java.util.Scanner;
public class FindAreaOfTriangle
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("Please enter width of triangle: ");
double base = sc.nextDouble();
System.out.println("Please enter height of triangle: ");
double height = sc.nextDouble();
double area = (base * height) / 2;
System.out.println("Area of triangle is: " + area);
sc.close();
}
}