Jumat, 30 Desember 2011

tugas algoritma modul 12

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());
}
}

0 komentar:

Posting Komentar

Statistik

Translate

Blog Archive