java - Multiplying by indexes position in 2 arrays -
Due to being quite new in Java I have a quick question and I have not seen it here. I have 2 array lists, And in order to answer me, each list must be multiplied in the index position in each list, eg. ArrayListAlpha (0,1,2,3 etc.) ArrayListBeta (0,1,2,3 etc.)
So I have to multiply 1x1, 2x2, 3x3 etc. and then display the answer onscreen In descending order; I also need to calculate and show information in the array. Like 1x1 = 2x2 = 3x3 = Can someone tell me in the right direction? Thanks
A very simple way:
For (int i = 0; i & lt; ArrayListAlpha.size (); i ++) {System.out.println (i + "x" + i + "=" + Arrielast elpha .Get (i) * Arrielist Beta.thet (i)); }
Comments
Post a Comment