Answer the question
In order to leave comments, you need to log in
"reversely symmetrical" array, how can I finish it?
Write a method that takes an array as a parameter and fills it with positive random two-digit numbers so that the value of the first element is equal to the value of the last, the value of the second element is equal to the value of the penultimate one, and so on. ..
I saw the task, it's not difficult, I'm sitting, writing, I'm already thinking about the end, but op! And I'm in a stupor. It may be so obvious, but it doesn't reach me at all :)
import java.util.*;
class Practice2{
static Scanner eva = new Scanner(System.in);
public static void main(String[] args) {
int n;
n = eva.nextInt();
int []m = new int [n];
fill(m);
write(m);
}
static void write(int []m) {
for(int i=0; i<m.length;i++)
System.out.print(m[i]+" ");
}
static void fill(int []m) {
int count = 0;
for(int i=0; i<m.length/2;i++) {
count++;
m[i]=10+(int)(Math.random()*90);}
for (int n = count; n<m.length; n++) {
/* тут голова вообще не варит, хотя понимаю, что здесь
* всё просто:( (может быть метод неверный)
*/
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question