Answers for "equation for amount of squares in a grid"

0

equation for amount of squares in a grid

/** * I'm using my own versions of max and min because * Math package only has max() float64 and min() float64 */func max (a,b int) int {  if a > b {  return a  } else {  return b  }  return 0}func min (a,b int) int {  if a < b {  return a  } else {  return b  }  return 0}func count(n, m int) int { s, b := min(n, m), max(n, m) r := 0 for i := 1; i <= s; i++ { r += (s - i + 1) * (b - i + 1) } return r}func main() { fmt.Print(count(2,3));}
Posted by: Guest on March-08-2021
0

equation for amount of squares in a grid

4x3 = 20 4x4 = 30 4x5 = 40 4x6 = 50 4x7 = 60 4x8 = 70 4x9 = 80// Guess what is the next value!
Posted by: Guest on March-08-2021

Code answers related to "equation for amount of squares in a grid"

Browse Popular Code Answers by Language