```
public int[] ProductExceptSelf(int[] nums) {
int[] output = new int [nums.Length];
int m1 = 1, m2 = 1;
for(int i = 0; i < nums.Length; i++) output[i] = 1;
for(int i = 0; i < nums.Length; i++) {
output[i] *= m1;
output[nums.Length - i - 1] *= m2;
m1 *= nums[i];
m2 *= nums[nums.Length - i - 1];
}
return output;
}
```