0% found this document useful (0 votes)
34 views2 pages

Operator Aritmatika

The document discusses arithmetic operators in the Java programming language including addition, subtraction, multiplication, division, and modulus. Examples are provided showing how to use each operator by declaring integer variables, performing operations on them, and printing the results. The operators allow performing basic math functions in Java code.

Uploaded by

Dava Anugrah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views2 pages

Operator Aritmatika

The document discusses arithmetic operators in the Java programming language including addition, subtraction, multiplication, division, and modulus. Examples are provided showing how to use each operator by declaring integer variables, performing operations on them, and printing the results. The operators allow performing basic math functions in Java code.

Uploaded by

Dava Anugrah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

OPERATOR ARITMATIKA

Tabel berikut merangkum operator aritmatika dalam bahasa pemrograman Java

Contoh
1. Penambahan (+)
int bilangan1 = 8;
int bilangan2 = 4;
int hasil = bilangan1 + bilangan2;
System.out.println(bilangan1 + " + " + bilangan2 + " = " + hasil);

2. Pengurangan (-)
int bilangan1 = 8;
int bilangan2 = 4;
int hasil = bilangan1 - bilangan2;
System.out.println(bilangan1 + " - " + bilangan2 + " = " + hasil);

=
3. Perkalian (*)
int bilangan1 = 8;
int bilangan2 = 4;
int hasil = bilangan1 * bilangan2;
System.out.println(bilangan1 + " x " + bilangan2 + " = " + hasil);

4. Pembagian (/)
int bilangan1 = 8;
int bilangan2 = 4;
int hasil = bilangan1 / bilangan2;
System.out.println(bilangan1 + " / " + bilangan2 + " = " + hasil);

5. Modulus (%) (sisa pembagian)


int bilangan1 = 9;
int bilangan2 = 4;
int hasil = bilangan1 % bilangan2;
System.out.println(bilangan1 + " % " + bilangan2 + " = " + hasil);

You might also like