Created
October 16, 2015 11:36
-
-
Save ardianta/6cbbb9a524d779ba5694 to your computer and use it in GitHub Desktop.
Program menghitung luas segitiga
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pertemuan2; | |
import java.util.Scanner; | |
public class LuasSegitia { | |
public static void main(String[] args) { | |
// deklarasi | |
Double luas; | |
int alas, tinggi; | |
// mebuat scanner baru | |
Scanner baca = new Scanner(System.in); | |
// Input | |
System.out.println("== Program hitung luas Segitiga =="); | |
System.out.print("Input alas: "); | |
alas = baca.nextInt(); | |
System.out.print("Input tinggi: "); | |
tinggi = baca.nextInt(); | |
// proses | |
luas = Double.valueOf((alas * tinggi) / 2); | |
// output | |
System.out.println("Luas = " + luas); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment