Membuat Program Ascending dengan Inputan Dinamis pada NetBeans
Membuat Program Ascending dengan Inputan Dinamis pada NetBeans
package input_dinamis;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class I_Dinamis
{
public static void main(String[] args) {
System.out.println(" ASCENDING ");
System.out.println(" I Made Danan Widagdo ");
System.out.println(" 140010341 ");
int a ;
int b ;
int c ;
int d ;
int e ;
Scanner s = new Scanner(System.in);
System.out.print("Masukan Bilangan A = ");
a = s.nextInt();
System.out.print("Masukan Bilangan B = ");
b = s.nextInt();
System.out.print("Masukan Bilangan C = ");
c = s.nextInt();
System.out.print("Masukan Bilangan D = ");
d = s.nextInt();
System.out.print("Masukan Bilangan E = ");
e = s.nextInt();
List<Integer> list = new ArrayList<>();
list.add(a);
list.add(b);
list.add(c);
list.add(d);
list.add(e);
System.out.println(list);
Collections.sort(list);
System.out.println(list);
}
}
0 comments: