
Create a program that will: a) Create the array and populate it with the given values.
9, 8 2, 17 49, 4 13, 119 2, 19 11, 47 3, 73
b) Multiply, for each row, the value of the first column by the value of the second column, and create a grand sum of these products. c) Print out the grand sum obtained in c)
so far this is my code and it is giving me 216. and if i do it manualy it is wrong.
public class Arrays { public static void main(String[] args) { int array_x[][]={ {9,8}, {2,17},
{49,4},
{13,119},
{2,19},
{11,47},
{3,73}};
{ int sum=0; int multiply=0;
for (int x=0; x<=6; x++){ multiply = arrayx[x][0]*arrayx[x][1]; //} sum = sum+multiply; } System.out.println(multiply); }
} }
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.