Menentukan Bilangan Terbesar dari Bilangan Bulat
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author toshiba
*/
import java.util.Scanner;
public class bilanganbulat {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int bilangan;
int Max;
int Counter[];
System.out.print("Masukkan jumlah angka yang ingin diinputkan: ");
bilangan = input.nextInt();
Counter = new int[bilangan];
for (int i = 0; i < bilangan; i++) {
System.out.print("Masukkan angka : ");
Counter[i] = input.nextInt();
Max = Counter[0];
for (int k = 0; k < bilangan; k++) {
if (Counter[k] > Max) {
Max = Counter[k];
}
}
System.out.println("Bilangan Bulat Yang Terbesar : " + Max);
}
}
}
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author toshiba
*/
import java.util.Scanner;
public class bilanganbulat {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int bilangan;
int Max;
int Counter[];
System.out.print("Masukkan jumlah angka yang ingin diinputkan: ");
bilangan = input.nextInt();
Counter = new int[bilangan];
for (int i = 0; i < bilangan; i++) {
System.out.print("Masukkan angka : ");
Counter[i] = input.nextInt();
Max = Counter[0];
for (int k = 0; k < bilangan; k++) {
if (Counter[k] > Max) {
Max = Counter[k];
}
}
System.out.println("Bilangan Bulat Yang Terbesar : " + Max);
}
}
}
Komentar
Posting Komentar