Hello, I can not figure out how to write a formula, the problem is in the sum:

    2 answers 2

    Not only Swift question of course applies. Example of how to expand the formula: enter image description here

    Use nested loops. For example:

    var sum = 0 for i in 1...3 { for j in 1...2 { sum += a[i][j] } } 

      since A and B do not depend on i and j, you can simply multiply all 4 and get the result. A B m * n

      • Try to write more detailed answers. You can include sample code, explain the solution, provide links with a more detailed analysis of the problem, etc. - Athari