Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package aritmatikadasar;
- public class AritmatikaDasar {
- public static void main(String[] args) {
- // TODO code application logic here
- System.out.println("Operasi Aritmatika "+"pada tipe integer");
- int a = 6 + 2;
- int b = 8 - 3;
- int c = 10 * 3;
- int d = c / 2;
- 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("Operasi Aritmatika "+"pada tipe floating-point");
- double fa = 6 + 2;
- double fb = 8 - 3;
- double fc = 10 * 3;
- double fd = c / 2;
- double fe = -a;
- System.out.println("Nilai fa: " + fa);
- System.out.println("Nilai fb: " + fb);
- System.out.println("Nilai fc: " + fc);
- System.out.println("Nilai fd: " + fd);
- System.out.println("Nilai fe: " + fe);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment