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 :
0 komentar:
Posting Komentar