Koding NetBeans yang Menampilkan Hasil Penjumlahan, Pengurangan, Perkalian dan Pembagian
Dosen Pengampuh : Fince Tinus Waruwu, S.Kom, M.Kom
package rosliana;
public class rosliana {
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 ("===================================================");
}
}
package rosliana;
public class rosliana {
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 ("===================================================");
}
}
Komentar
Posting Komentar