((n - Math.Abs(j / 2) - 1) * (n - Math.Abs(j / 2))) / 2 + i + 1
this line of code is giving output of 1 for values set n=4;j=7;i=0
when i do manually on paper i am getting 0/3 =0 what am i doing wrong and what is this formula called provided this formula exists.
To further elborate my manual calculation
step 1: ((4-Math.Abs(7/2)-1) *(4-Math.Abs(7/2)))/2+0+1
step 2: ((4-Math.Abs(3.5)-1) *(4-Math.Abs(3.5)))/3
__________________________________________^ this "3" is wrong!!!!
step 3: ((0.5-1) *(0.5))/3
step 4: ((-0.5)*(0.5))/3
step 5: (-0.25)/3
step 6: 0/3=0
i am getting zero
but computer is giving 1 as output
I'm assuming integer division.