Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class kalkulatorCLI {
- public static void main(String args[])
- {
- Scanner input = new Scanner(System.in);
- int bil1, bil2, pil ,hasil = 0;
- System.out.println("PROGRAM JAVA KALKULATOR SEDERHANA");
- System.out.println("1. Persegi");
- System.out.println("2. Segitiga");
- System.out.println("3. Persegi Panjang");
- System.out.println("----------------------------");
- System.out.print("Bilangan 1 : ");
- bil1=input.nextInt();
- System.out.print("Bilangan 2 : ");
- bil2=input.nextInt();
- System.out.print("Pilihan Operasi: ");
- pil=input.nextInt();
- switch (pil){
- case 1 : persegi();break;
- case 2 : segitigas();break;
- case 3 : persegi_panjang();break;
- default : System.out.println("Salah memasukan pilihan");
- }
- System.out.println("Hasil :"+hasil);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment