input: len = 6, array[]={1,2,3,4,5,6}

output1,2)(3,4)(5,6)//set 1

(1,4)(2,6)(3,5)//set 2

(1,6)(4,5)(2,3)//set 3

(1,6)(5,3)(4,2)//set 4 invalid

so on

struct pairSet

{

int p1;

int p2;

};

int main()

{

int a[]={1,2,3,4,5,6};

int i;

int j,k;

int count=0;

struct pairSet ps[6];

int len = sizeof(a)/sizeof(a[0]);

printf("Set 1\n");

for(i=0;i<len

{

for(j=i+1;j<len;j++)

{

ps[count].p1 = a

*;*

ps[count].p2 = a[j];

//printf("(%d,%d)\n",a

ps[count].p2 = a[j];

//printf("(%d,%d)\n",a

*,a[j]);*

break;

}

count++;

i=i+2;

}

for(k=0;k<count;k++)

{

printf("(%d,%d) ",ps[k].p1,ps[k].p2);

}

printf("\n");

}

I have tried for set 1. can you please help me out for remaining sets

find set of all possible pairsbreak;

}

count++;

i=i+2;

}

for(k=0;k<count;k++)

{

printf("(%d,%d) ",ps[k].p1,ps[k].p2);

}

printf("\n");

}

I have tried for set 1. can you please help me out for remaining sets

find set of all possible pairs