Code:
for (x=2; x>0; x--)
{ for (y=2; y>0; y--)
   { if(y==x) continue;
      cout<<x<<","<<y<<endl;
    }
}
There is a little code that will do it for 2!. You can expand on that for 4!.