CONTOH PROGRAM PERHITUNGAN ARITMATIKA DALAM BAHASA JAVA
PROGRAMNYA
:
import java.util.Scanner;
class hitungan_aritmatika
{
public static void main(String args[])
{
Scanner angka=new Scanner(System.in);
int A,B;
System.out.print("Bilangan 1 :");
A=angka.nextInt();
System.out.print("Bilangan 2 :");
B=angka.nextInt();
System.out.println(" ");
System.out.println("Bilangan
1:"+A);
System.out.println("Bilangan
2:"+B);
System.out.println(" ");
System.out.println("Hasil Operator
Aritmatika");
System.out.println("=========================");
System.out.println("A+B= "+(A+B));
System.out.println("A-B= "+(A-B));
System.out.println("A*B= "+(A*B));
System.out.println("A:B= "+(A/B));
System.out.println("A%B= "+(A%B));
System.out.println(" ");
}
}
HASIL
OUTPUT :
Tidak ada komentar:
Posting Komentar