I am facing a challenge with my array:
money(v, q)
[50, 2]
[20, 2]
[10, 2]
.
.
.
n
I have a specific calculation that I need to perform.
(money[0].v * money[0].q) + (money[1].v * money[1].q) + (money[n].v * money[n].q)
Can anyone provide assistance with this task?
I attempted to solve it using the following code snippet:
for (i = 0; i > money.length; i++)
{
(money[i].v * money[i].q) + (money[i++].v * money[i++].q)
}
However, I realized that there is a mathematical error in my approach and I am not sure how to correct it.
Your help would be greatly appreciated. Thank you.