0
How to store all for loop result in an array ( out side the for loop) in java?
want to store all result of loop in an array.
1 Odpowiedź
0
what do u mean by loop result?
i'll assume u want to store 1 til n into array of length n
int n = 5;
int[] arr = new arr[n];
for (int i = 0; i < n; i++) {
arr[i] = i + 1;
}