Selasa, 24 September 2013

OPRASI LIMA BILANGAN

//======================================//
// By : Agung Yudi Santoso                   //
// Universitas Muhammadiyah Gresik      //
// 22:00WIB 11-September-2013                //
//======================================//
package pemrogramanberbasisobject;
import java.util.Scanner;
public class OperasiLimaBilangan {

    public static void main(String[] args) {
        Scanner i=new Scanner(System.in);

        int []bil=new int[5];
        double []bil2=new double[5];
        int h_Tambah=0;
        int h_Kurang=0;
        double h_Kali=1;
        for(int a=0;a<bil.length;a++){
            System.out.print("Masukan Bilanga ke-"+(a+1)+" : ");
            bil[a]=i.nextInt();
            bil2[a]=Double.valueOf(bil[a]);
            h_Tambah=h_Tambah+bil[a];
            h_Kurang=h_Kurang-bil[a];
            h_Kali=h_Kali*bil2[a];
        }
        System.out.println("\n\nHasil Penjumlahannya:\n"+bil[0]+" + "+bil[1]+" + "+bil[2]+" + "+bil[3]+" + "+bil[4]+" = "+h_Tambah);
        System.out.println("\n\nHasil Pengurangannya:\n"+bil[0]+" - "+bil[1]+" - "+bil[2]+" - "+bil[3]+" - "+bil[4]+" = "+h_Kurang);
        System.out.println("\n\nHasil Perkaliannya:\n"+bil[0]+" x "+bil[1]+" x "+bil[2]+" x "+bil[3]+" x "+bil[4]+" = "+h_Kali);
        System.out.println("\n\nHasil Pembagiannya:\n"+bil[0]+" / "+bil[1]+" / "+bil[2]+" / "+bil[3]+" / "+bil[4]+" = "+(bil2[0]/bil2[1]/bil2[2]/bil2[3]/bil2[4]));
    }
}









Outputnya Kayak gini kawan




YUK SILAHKAN SEDOT GAN :)

Tidak ada komentar:

Posting Komentar