Selasa, 22 Mei 2018

Program Java :Koding Program Netbeans Pertemuan 2

Dosen pengampu : Fince Tinus Waruwu, M.Kom


Koding NetBeans yang Menampilkan Hasil Penjumlahan, Pengurangan, Perkalian dan Pembagian

package agnes.lestari.manalu;

public class AgnesLestariManalu {

    public static void main(String[] args) {

        int nilai1 = 3;
        int nilai2 = 4;
        int penjumlahan;
        penjumlahan = nilai1+nilai2;
        System.out.println("Nilai 1="+nilai1);
        System.out.println("Nilai 2="+nilai2);
        System.out.println ("Hasil Penjumlahan = "+penjumlahan);
        System.out.println ("===================================================");
        int nilai3 = 7;
        int nilai4 = 4;
        int pengurangan;
        pengurangan = nilai3-nilai4;
        System.out.println("Nilai 1="+nilai3);
        System.out.println("Nilai 2="+nilai4);
        System.out.println ("Hasil Pengurangan = "+pengurangan);
        System.out.println ("===================================================");
        int nilai5 = 3;
        int nilai6 = 4;
        int perkalian;
        perkalian = nilai5*nilai6;
        System.out.println("Nilai 1="+nilai5);
        System.out.println("Nilai 2="+nilai6);
        System.out.println ("Hasil Perkalian = "+perkalian);
        System.out.println ("===================================================");
        int nilai7 = 8;
        int nilai8 = 4;
        int pembagian;
        pembagian = nilai7/nilai8;
        System.out.println("Nilai 1="+nilai7);
        System.out.println("Nilai 2="+nilai8);
        System.out.println ("Hasil Pembagian = "+pembagian);
        System.out.println ("===================================================");
   }


}

Maka akan tampil seperti pada gambar di bawah ini :


Tidak ada komentar:

Posting Komentar