-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.java
32 lines (21 loc) · 955 Bytes
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.util.Scanner;
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// Ask for user input for edges of the triangle
System.out.println("Üçgenin birinci kenarını giriniz: ");
int edge1 = scanner.nextInt();
System.out.println("Üçgenin ikinci kenarını giriniz: ");
int edge2 = scanner.nextInt();
System.out.println("Üçgenin üçüncü kenarını giriniz: ");
int edge3 = scanner.nextInt();
// Calculate the perimeter
double u = (edge1 + edge2 + edge3) / 2.0;
// Calculate the area
double area = Math.sqrt(u * (u - edge1) * (u - edge2) * (u - edge3));
// Print the area
System.out.println("Üçgenin alanı: " + area);
}
}