Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Java/Java 1D Array.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//Name:Nikhil Srivastava
//Date:21/10/2022

import java.util.*;

public class Solution {

public static void main(String[] args) {

Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
//Declaring an integer array a of size n
int[] a=new int[n];

//Using for loop to store n integers in the array.
for(int i=0;i<n;i++)
a[i]=scan.nextInt();
scan.close();

// Prints each sequential element in array a
for (int i = 0; i < a.length; i++) {
System.out.println(a[i]);
}
}
}