Hello,
I am going crazy with a simple issue on Arrays. I have spent hours on this (beginner!) I am trying to have an array and divide the second element by the first, the third by the second, the fourth by the third....
In other words,
int [] test = {a, b, c, d}; //Using letters for illustrative purposes
//desired code is "divide b by a, c by b, d by c...
========================
My code looks like this:
public class ArrayTest {
/**
* @param args
*/
public static void main(String[] args) {
int[] stock = {1,2,5,8};
for(int x : stock) {
System.out.println("This is the element value:" + x);
for(int i = 0; i < 5 ; i++) {
int y = stock[i + 1] / stock;
System.out.println(y);
}
}
}
}
If anyone could help me or guide me to the right resources.
Thanks,
SymDev