Tuesday, March 12, 2013

Program Penambahan, Pengurangan, Perkalian, Pembagian dan MOD dengan Java

BY Populeritas No comments


Langsung aja gue kasih scriptnya ya? jangan lupa belajar! jangan copas-copas melulu ! salam POPULERITAS


public class Matematika {
public static void main (String [] args) {

    int j = 42;
    int i = 37;
   
    double x = 27.475;
    double y = 7.22 ;
   
System.out.println ("Variable Values");
System.out.println ("Penambahan") ;
System.out.println ("i - j = " + (i+j)) ;
System.out.println ("x - y = " + (x+y)) ;

System.out.println ("Pengurangan") ;
System.out.println ("i - j = " + (i-j)) ;
System.out.println ("x - y = " + (x-y)) ;

System.out.println ("Pembagian") ;
System.out.println ("i / j = " + (i/j)) ;
System.out.println ("x / y = " + (x/y)) ;

System.out.println ("Perkalian") ;
System.out.println ("i x j = " + (i*j)) ;
System.out.println ("x x y = " + (x*y)) ;

System.out.println ("Mod") ;
System.out.println ("i mod j = " + (i % j)) ;
System.out.println ("x mod y = " + (x % y)) ;

}
}


Setelah Program Penambahan, Pengurangan, Perkalian, Pembagian dan MOD dengan Java di Run, akan muncul seperti ini:

0 comments: