Last active
May 25, 2016 15:22
-
-
Save neilghosh/d788a29db2ca7ea95fd39483b278ad3d to your computer and use it in GitHub Desktop.
Read Command Line Numbers In Java
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
/* | |
* 1st line input - two numbers space separated | |
* 2nd line input - series (1st number of last line times) of number space separated | |
*/ | |
import java.util.*; | |
import java.lang.*; | |
import java.io.*; | |
class ReadFromCommandLine { | |
public static void main (String[] args) { | |
Scanner scan = new Scanner(System.in); | |
int size = scan.nextInt(); | |
int sum = scan.nextInt(); | |
int[] a = new int[size]; | |
scan.nextLine(); | |
for(int i = 0; i < size ; i++) { | |
a[i] = scan.nextInt(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment