Hi, I have an array : int [] num = new int[6]{1,2,2,1,1,2};
I want to multiply the value at element 0 with every other value, I then want to multiply the value at element 1 with the values at elements 2 through to the last element. Then multiply the value at element 2 with the values from 3 through to the end, and so on until I have iterated through the whole array.
My efforts thus far seem clumsy and verbose, so I was wondering if anyone could show me an elegant way of achieving my aim.
Many thanks.
You can go through the array backwards and do it in one pass and not repeat operations.
Gives
8,8,4,2,2,2