You are on page 1of 2

import java.util.

Scanner;
public class OneD
{
public static void main(String args[])
{
int arr[] = new int[50];
int n, i;

System.out.print("How Many Element You Want to Store in Array ? ");


Scanner scan = new Scanner(System.in);
n = scan.nextInt();
System.out.print("Enter " + n + " Element to Store in Array : ");
for(i=0; i<n; i++)
{
arr[i] = scan.nextInt();
}
System.out.print("Elements in Array is :\n");
for(i=0; i<n; i++)
{
System.out.print(arr[i] + " ");
}
}
}

You might also like