[Code@Cafe] JAVA-Input Array dari Panjang Array yang Diinginkan

import java.util.Scanner;

class customizeArray
{
static Scanner input = new Scanner(System.in);

public static void main (String[] args)
{
int i;
System.out.println(“Inputkan panjang array : “);
int n = input.nextInt();
int[] array = new int[n];

System.out.println(“Inputkan nilai array : “);
for(i=0;i<n;i++)
{
int j = input.nextInt();
array[i] = j;
}

System.out.println(“Panjang array : “+n);
System.out.println(“Tampilkan nilai array : “);
for(i=0;i<n;i++)
{
System.out.println(array[i]);
}
}
}

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

WordPress.com.

Up ↑

%d bloggers like this: