import java.util.Scanner;
public class Method2 {
int a, b;
public int jumlah(){
return (a+b);
}
public int kali(){
return (a*b);
}
public int bagi(){
return (a/b);
}
public int kurang(){
return (a-b);
}
public static void main (String[] args){
Scanner data=new Scanner (System.in);
Method2 coba=new Method2();
System.out.print("Masukkan bilangan: ");
coba.a=data.nextInt();
System.out.print("Masukkan bilangan: ");
coba.b=data.nextInt();
System.out.println("Hasil jumlah "+coba.jumlah());
System.out.println("Hasil kali "+coba.kali());
System.out.println("Hasil bagi "+coba.bagi());
System.out.println("Hasil kurang "+coba.kurang());
}
}
Tidak ada komentar:
Posting Komentar