- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArray_Single_Dim.java
More file actions
Latest commit
20 lines (20 loc) · 568 Bytes
/
Copy pathArray_Single_Dim.java
File metadata and controls
20 lines (20 loc) · 568 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
importjava.util.Scanner;
classArray_Single_Dim
{
publicstaticvoidmain (Stringargs[])
{
Scannerscan=newScanner(System.in);
System.out.print("Enter the Array length: ");
intlen=scan.nextInt();
intarr[]=newint[len]; //declaration and creation i dim array
System.out.println("Enter the array elements");
for(inti=0; i<len; i++)
{
arr[i]=scan.nextInt();
}
System.out.println("\narray elements are:");
for(inti=0; i<len; i++){
System.out.println(arr[i]);
}//display every array element
}
}