-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTriangle.java
More file actions
22 lines (16 loc) · 766 Bytes
/
Triangle.java
File metadata and controls
22 lines (16 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package Hamic.BasicJava.week1;
import java.util.Scanner;
public class Triangle {
public static void main(String[] args) {
try (Scanner scanner = new Scanner(System.in)) {
System.out.print("Enter the measure of an angle (in degrees): ");
double angle = scanner.nextDouble();
System.out.print("Enter the length of the first adjacent side: ");
double side1 = scanner.nextDouble();
System.out.print("Enter the length of the second adjacent side: ");
double side2 = scanner.nextDouble();
double area = 0.5 * side1 * side2 * Math.sin(Math.toRadians(angle));
System.out.println("The area of the triangle is: " + area);
}
}
}