Dividing contents of 2 dimentional array into one array

Why does my avgHi array output zero if I divide the contents of the two arrays but if I add or subtract them, then I get the correct result?
1
2
3
4
  for (int i = 0; i < rows ; i++)
    {
        avgHi[i] = nums[i][1] / nums[i][0];
    }
Probably integer division.

4 / 8 gives ... wait for it ....0
Thank you. I was able to fix this by adding (float) to one of the numbers being divided.

1
2
3
4
    for (int i = 0; i < rows ; i++)
    {
        avgHi[i] = (float)nums[i][1] / nums[i][0];
    }
Topic archived. No new replies allowed.