Java Script Operasi Hitung dan Pemecahan Uang

Script Operasi Hitung :

 

import java.util.Scanner;
public class modul1 {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int total;
int grade;
int rata;
int counter;
int n;
double bagi;
System.out.println(“Input: “);
System.out.print(“Bilangan Pertama: “);
n=input.nextInt();
System.out.print(“Bilangan Kedua: “);
grade=input.nextInt();
System.out.println(” “);
rata=n+grade;
counter=n-grade;
total=n*grade;
bagi=n/grade;
System.out.println(“Output:”);
System.out.println(“Hasil Penjumlahan: “+rata);
System.out.println(“Hasil Pengurangan: “+counter);
System.out.println(“Hasil Perkalian: “+total);
System.out.println(“Hasil Pembagian: “+bagi);
}
}

Script Pemecahan Uang :

 

import java.util.Scanner;
public class modul2 {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int total;
int total1;
int total2;
int total3;
int total4;
int a;
System.out.println(“Input: “);
a=input.nextInt();
total1=a/10000;
a=a-(total1*10000);
total2=a/5000;
a=a-(total2*5000);
total3=a/100;
a=a-(total3*100);
total4=a/50;
a=a-(total4*50);
System.out.println(“Jumlah Pecahan Uang: “);
System.out.println(“Sepuluh Ribuan: “+total1);
System.out.println(“Lima Ribuan: “+total2);
System.out.println(“Seratusan: “+total3);
System.out.println(“Lima Puluhan: “+total4);

}
}

Leave a comment

No comments yet.

Comments RSS TrackBack Identifier URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s