Created
November 19, 2015 12:49
-
-
Save eMahtab/df3ab74b5fa331784d15 to your computer and use it in GitHub Desktop.
Java program to take one dimensional array as input.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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