2 operan , + operasi
operasi kalkolator biasa aja
contoh
public class Dua {
public static void main(String[] args){
int a=5,b=9,z;
z=a*b;
System.out.println(("jumlah ")+ (a+b-1));
System.out.println(("jumlah ")+ (a+b-1));
System.out.println("jumlah "+ (a+b));
System.out.println("jumlah "+ (a-b));
System.out.println("jumlah "+ (a/b));
System.out.println("jumlah "+ (a*b));
System.out.println("jumlah "+ (a%b));
System.out.println("jumlah "+ (a+b));
System.out.println(a/b));
System.out.println((double)a/b));
System.out.println("hasil= " + (5 / 2));
System.out.println("hasil = " + (5 / 2.0));
System.out.println("hasil panen = " + (5.0 / 2));
System.out.println("hasil aoa = " + (5.0 / 2.0));
}
}
hasil::
run:
jumlah 13
jumlah 13
jumlah 14
jumlah -4
jumlah 0
jumlah 45
jumlah 5
jumlah 14
0
0.5555555555555556
hasil= 2
hasil = 2.5
hasil panen = 2.5
hasil aoa = 2.5
BUILD SUCCESSFUL (total time: 13 seconds)
Tidak ada komentar:
Posting Komentar