..:Welcome to My Blog:..

Clock

Entri Populer

Powered By Blogger

Total Tayangan Halaman

Pages

Menerima Inputan dari Keyboard menggunakan Scanner

Sript :
import java.util.Scanner;

public class T1_Scanner {

    public static void main(String[] args) {
        int bil1, bil2, bil3, counter;
        float average;
        Scanner input = new Scanner(System.in);
        System.out.print("Masukkan Bilangan ke-1 : ");
        bil1 = input.nextInt();
        System.out.print("Masukkan Bilangan ke-2 : ");
        bil2 = input.nextInt();
        System.out.print("Masukkan Bilangan ke-3 : ");
        bil3 = input.nextInt();
        counter = bil1 + bil2 + bil3;
        average = counter / 3;
        System.out.println("-----------------------------------");
        System.out.println("Jumlah Bilangan        : " + counter);
        System.out.println("Rata - Rata Bilangan   : " + average);
    }
}

Implementasi :


Output :


0 komentar:

Posting Komentar

Pengikut