I need to write a factorial using an array but the problem is only Show 120 five times and what i want is 1, 2, 6, 24, 120 showing in the textBox
int factProg = 1;
public void factArray(int[] arr)
{
for (int i = 0; i < arr.Length; i++)
{
factProg = factProg * arr[i];
}
}
int[] arr = {1,2,3,4,5};
for (int i = 0; i < arr.Length; i++)
{
factArray(arr);
textBox1.Text += Convert.ToString(factProg);
textBox1.Text += Environment.NewLine;
}
int fact(int i)=>i*fact(i-1);and then in theforloopfact(arr[i])instead offactArray(arr)