/**
*
* @author Geminiclev
*/
import
java.util.Scanner;
public
class OperasiAritmatik {
public
static void main(String[] args) {
String
bil1= args[0];
String
bil2= args[1];
int
sum ;
int
difference ;
int
product;
int
quotient;
Scanner
in = new Scanner(System.in);
System.out.println("Inputkan
2 buah Bilangan");
bil1
= in.nextLine();
bil2
= in.nextLine();
if
(args.length > 0){
int
a = Integer.parseInt(bil1);
int
b = Integer.parseInt(bil2);
sum=
a+b;
difference
= a - b;
product
= a * b;
quotient
= a / b;
System.out.println("Sum ="+sum);
System.out.println("Different
="+difference);
System.out.println("Product ="+product);
System.out.println("Quotient ="+quotient);
}
}
}
Upzz jangan lupa properties projectnya diganti ya dengan bil1 dan bil2.
thanks infonya kak,, Ralat sedikit seharusnya gak harus pake inputan import Scanner.
ReplyDeleteinputanny kan sdah ada, itu kan argumen command line,, inputannya dari command line
terimakasih :)
Terimakasih ralatny. Semoga bermanfaat.
ReplyDelete