Skip to content

Instantly share code, notes, and snippets.

@eMahtab
Created November 19, 2015 12:49
Show Gist options
  • Save eMahtab/df3ab74b5fa331784d15 to your computer and use it in GitHub Desktop.
Save eMahtab/df3ab74b5fa331784d15 to your computer and use it in GitHub Desktop.
Java program to take one dimensional array as input.
import java.util.Scanner;
public class OneDArrayInput{
public static void main(String args[]){
System.out.print("Enter number of inputs : ");
Scanner sc=new Scanner(System.in);
int size=sc.nextInt();
int oneD[]=new int[size];
for(int i=0;i<size;i++){
oneD[i]=sc.nextInt();
}
for(int x:oneD){
System.out.print(x+" ");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment