Im a programming student and im having alot of trouble with this question:
"complete a static method multiplesOf which takes two int parameters, number and count. The method body must return an int array containing the first count multiples of number. For example,
multiplesOf(5, 4) should return the array { 5, 10, 15, 20 } multiplesOf(11, 3) should return the array { 11, 22, 33 } multiplesOf(1, 15) should return the array { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
You must not use System.out.print or System.out.println in your method."
This is my current code:
public static void main(String[] args) {
multiplesOf(5,4);
}
public static int[] multiplesOf (int number, int count) {
int[] a = new int[count];
a[0]= number;
for(int i = 0; i<count; i++) {
a[i] = (a[i]*count);
}
return a;
}
Ive been trying to figure out why the array "a" still only has the values 0,1,2,3
a[i] = (a[i]*count);do?