Hi all,
I need to find combinations, and calculate values for the resultant combinations by substituting values..
string[] str=new string[]{"A","B","C","D"};
double[] vals=new double[]{1,3,6,9};
A=1;
B=3;
C=6;
D=9
Say N=4,M=3;// N and M are Dynamic values
N-M+1=2;
so i want to find combinations for str with N-M+1 Value ie 4C2 = 6.
i am getting 6 Combinations.
AB
AC
AD
BC
BD
CD..
finally i want to calculate & store the combination values in another Array..
I used below code, it works for N=4,M=2
for (int j = 0; j < factval; j++)
{
for (int k = 0; k < PFDdu.Length; k++)
{
if (!string.IsNullOrEmpty(PFDdu[(k + 1) % PFDdu.Length].ToString()))
{
if (j != (k + 1) % PFDdu.Length)
{
faval[j] = faval[j] * PFDdu[(k + 1) % PFDdu.Length];
}
}
}
}
Can any body help me on this plz..
with Regards,
Pawan.