Jumat, 10 April 2015

Operasi aritmatika dasar pada tipe integer dalam Java

Input :

public class BelajarJava2 {
    public static void main (String [] args){
       int a = 5+1;
       int b = 6-1;
       int c = 5*3;
       int d = 8/2;
       System.out.println("Nilai A :" + a);
       System.out.println("Nilai B :" + b);
       System.out.println("Nilai C :" + c);
       System.out.println("Nilai D :" + d);
   }
}


Output :

Nilai A :6
Nilai B :5
Nilai C :15
Nilai D :4

Tidak ada komentar:

Posting Komentar