Source Code :
import java.io.*;
public class IOQuiz {
public static void main(String[] args) throws Exception{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String input;
double a;
double t;
double sM;
double luas;
double kel;
System.out.println("\n\n");
System.out.println("| ===================================================================== |");
System.out.println("| |");
System.out.println("| PROGRAM MENGHITUNG SISI MIRING, LUAS, DAN KELILING SEGITIGA SIKU-SIKU |");
System.out.println("| |");
System.out.println("| ===================================================================== |");
System.out.print("\nMasukkan alas : ");
input = in.readLine();
a = Double.parseDouble(input);
System.out.print("\nMasukkan tinggi : ");
input = in.readLine();
t = Double.parseDouble(input);
sM = Math.sqrt(Math.pow(a, 2) + Math.pow(t, 2));
//sM = Math.hypot(a, t);
luas = 0.5 * a * t;
kel = a + t + sM;
System.out.print("\n| ===================================================================== |");
System.out.printf("\n| Sisi Miring Segitiga : %.2f |", sM);
System.out.printf("\n| Luas Segitiga : %.2f |", luas);
System.out.printf("\n| Keliling Segitiga : %.2f |", kel);
System.out.println("\n| ===================================================================== |");
}
}
Outputnya :
Sunday, 7 September 2014
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment