Advertisement
satriafu5710

Menghitung Luas Segitiga Java

Feb 28th, 2022
1,110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.         Scanner userInput = new Scanner(System.in);
  8.  
  9.         int alas, tinggi;
  10.         double luas;
  11.  
  12.         System.out.println("\n\t Menghitung Luas Segitiga \n");
  13.  
  14.         System.out.print(" Inputkan Alas   : ");
  15.         alas = userInput.nextInt();
  16.  
  17.         System.out.print(" Inputkan Tinggi : ");
  18.         tinggi = userInput.nextInt();
  19.  
  20.         luas = (alas * tinggi) * 0.5;
  21.  
  22.         System.out.println("\n Luas Segitiga adalah : " + luas);
  23.  
  24.         System.out.println();
  25.     }
  26.  
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement