area of right angle triangle in java

Solutions on MaxInterview for area of right angle triangle in java by the best coders in the world

showing results for - "area of right angle triangle in java"
Veronica
23 Apr 2019
1import java.util.Scanner;
2
3public class Main {
4
5    public static void main(String[] args) {
6
7        // area of right angled triangle
8
9        Scanner scanner = new Scanner(System.in);
10
11        System.out.print("Enter base length: ");
12        float base = scanner.nextFloat();
13
14        System.out.print("Enter perpendicular length: ");
15        float perpendicular = scanner.nextFloat();
16
17        float area = 0.5f * base * perpendicular;
18
19        System.out.println("The area is: " + area);
20    }
21}