how can i take multiple input in single line in that is separated by spaces and is stored in array?
Taking multiple input in single line separated by spaces
@amoghsachdeva3
you can use for loop to assign values in an array.
Scanner scn=new Scanner(System.in);
int a[] =new int[n]
for(int i=0;i<n;i++){
a[i]=scn.nextInt();
}
where n =size of the array
it is working …thanks