> > Operator Aritmatika

Operator Aritmatika


public class OperatorAritmatika {
public static void main (String[] args){
int a = 20;
int b = 10;
double x = 30.45;
double y = 25.25;

System.out.println("Penjumlahan");
System.out.println("a + b = "+(a+b));
System.out.println("x + y = "+(x+y));
System.out.println();
System.out.println("Pengurangan");
System.out.println("a - b = "+(a-b));
System.out.println("x - y = "+(x-y));
System.out.println();
System.out.println("Perkalian");
System.out.println("a * b = "+(a*b));
System.out.println("x * y = "+(x*y));
System.out.println();
System.out.println("Pembagian");
System.out.println("a / b = "+(a/b));
System.out.println("x / y = "+(x/y));
System.out.println();
System.out.println("Sisa Bagi");
System.out.println("a % b = "+(a%b));
System.out.println("x % y = "+(x%y));

}
}

Leave a Reply

Powered by Blogger.