You need to create an empty array of 10 integers and fill it with values using a loop, each of which will be 3 times more than the previous one (starting with 1), that is, get [1, 4, 7, 10, 13, 16, 19, 22, 25, 28] .
I wrote this code:
public class massiv { public static void main(String[] args) { int[] array = new int[10]; array[0] = 1; for (int i = 0; i < array.length; i++) { array[i] = array[i] + 3; //вот тут туплю - не пойму как решить System.out.println(array[i]); } } } How to fill the array?
array[i] = i*3 + 1;- Yaant