Iseng-iseng sambil belajar JAVA dari pada kaga ada kerjaan ,,
Mohon di maklumi yah kalo masih suka ada yang salah ,,
class DemoArimatika {
public static void main(String[]args) {
System.out.println("Oprasi aritmatika"+"pada bilangan integr");
int a = 1 + 2;
int b = a - 1;
int c = a * b;
int d = c / 3;
int e = -a;
System.out.println("Nilai a:"+a);
System.out.println("Nilai b:"+b);
System.out.println("Nilai c:"+c);
System.out.println("Nilai d:"+d);
System.out.println("Nilai e:"+e);
System.out.println();
System.out.println();
System.out.println("Operasi Aritmatika"+"pada bilangan floating");
double wa = 2 + 1;
double wb = wa - 1;
double wc = wa * wb;
double wd = wa / 2;
double we = -wa;
System.out.println("Nilai wa:"+wa);
System.out.println("Nilai wb:"+wb);
System.out.println("Nilai wc:"+wc);
System.out.println("Nilai wd:"+wd);
System.out.println("Nilai we:"+we);
}
}
public static void main(String[]args) {
System.out.println("Oprasi aritmatika"+"pada bilangan integr");
int a = 1 + 2;
int b = a - 1;
int c = a * b;
int d = c / 3;
int e = -a;
System.out.println("Nilai a:"+a);
System.out.println("Nilai b:"+b);
System.out.println("Nilai c:"+c);
System.out.println("Nilai d:"+d);
System.out.println("Nilai e:"+e);
System.out.println();
System.out.println();
System.out.println("Operasi Aritmatika"+"pada bilangan floating");
double wa = 2 + 1;
double wb = wa - 1;
double wc = wa * wb;
double wd = wa / 2;
double we = -wa;
System.out.println("Nilai wa:"+wa);
System.out.println("Nilai wb:"+wb);
System.out.println("Nilai wc:"+wc);
System.out.println("Nilai wd:"+wd);
System.out.println("Nilai we:"+we);
}
}
Tidak ada komentar:
Posting Komentar