Sedikit berbagi . . . .
import java.io.*;
public class Kalkulator{
public static void main (String []args){
BufferedReader ai = new BufferedReader (new InputStreamReader (System.in));
try{
int bilangan1;
int bilangan2;
do{
System.out.println("===================================");
System.out.println("\t \"kalkulator sederhana\" \t");
System.out.println("===================================");
System.out.print("Masukan bilangan 1 : ");
bilangan1 = Integer.parseInt (ai.readLine());
System.out.print("Masukan bilangan 2 : ");
bilangan2 = Integer.parseInt (ai.readLine());
System.out.println("===================================");
System.out.println("\t \"kalkulator sederhana\" \t");
System.out.println("===================================");
System.out.println("Hasil Penjumlahan : "+ (bilangan1+bilangan2));
System.out.println("Hasil Pengurangan : "+ (bilangan1-bilangan2));
System.out.println("Hasil Perkalian : "+ (bilangan1*bilangan2));
System.out.println("Hasil Pembagian : "+ (double)(bilangan1/bilangan2));
}while(true);
}
catch (Exception e) {
System.out.println("Inputan harus angka");
}
}
}
0 komentar:
Posting Komentar