Home > Blockchain >  I need to multiply 1st Array list with 2nd Array list
I need to multiply 1st Array list with 2nd Array list

Time:07-29

In here get value into the arraylist, I'm using MySql database and Tables.

my 1st array list number of items can be 1 or 2 or 3 or 4 or 5,

my 2nd array contain number of 5 items.

for example;

arraylist1 = (10,50,50) arraylist2 = (2.6,2.4,1.7,1.4,1.1)

If when multiplying arraylist together,

total = (10 * 2.6) (50 * 2.4) (50 * 1.7) places can't be changed.

How to do that?

firstly I try with define the arralist2 and it worked.

arraylist2 = (2.6,2.4,1.7,1.4,1.1)

Code;

Dim a As Integer = 0

                For Each i In arraylist1
  

                    Ptotal  = arraylist2(a) * i

                    a  = 1

                Next

CodePudding user response:

Dim a As Integer = 0

                For Each i In distance_range

                    Ptotal  = price_rage(a) * i

                    a  = 1

                Next

CodePudding user response:

 Dim a As Integer = 0

                For Each i In arraylist1

                    Ptotal  = arraylist2(a) * i

                    a  = 1

                Next
  • Related