Just edit the following.
change to the required word.
Code: C
char str[]="G4EF"; // sample small word e.g. ABCDEF
 
Change to the proper value
Code: C
unsigned long num = fact(key[0]); // Chnage to n!/(r!(n-r)!)=6!/(2!(6-2)!)=15-1 = 14 as we loop till <= num
 
In the Display function change the for loop as follows
Code: C
for(int i=1;i<=k[0];i++) // change k[0] to (n-r) i.r. 4 in this case
 
Simple.