Category Archives: Uncategorized

24 Mar

Operator Perhitungan dengan Java

Perhitungan Operator Java

public class latihan {
public static void main(String[]args){
int a = 3;
int b = 2;

int tambah = a + b;
int kurang = a – b;
int kali = a * b;
int bagi = a % b;

System.out.println(“hasil ” + a+ “+” + b+ “=” +tambah);
System.out.println(“hasil ” + a+ “-” + b+ “=” +kurang);
System.out.println(“hasil ” + a+ “*” + b+ “=” +kali);
System.out.println(“hasil ” + a+ “%” + b+ “=” +bagi);

}
}