I want to read n values from the user but i don't know the value of n.
Say in first case {4,3,5,6,11,22} In second case{11,22,77,43,2,1,2111,322} Say i want to read 10 integer values from the user(second time 5 int value)(depends on each cases).
Second thing is I want to store this values in an array.
I am really stuck with this. Any help???
I tried the following code-
int a[50],i=-1;//how to dynamically assign memory to an array
Scanner s=new Scanner(System.in);
do{
a[++i]=s.nextInt();
}while(!hasNextLine());