这样应该可以了:
#include <stdio.h>
#include <stdlib.h>
void main()
{
int i,j,k,n=0;
char c[5][7]={"red","yellow","blue","white","black"};
for (i=0;i<5;i++)
for (j=i+1;j<5;j++)
for (k=j+1;k<5;k++)
{
if (i != j && j !=k && k!=i)
printf("%s %s %s\n",c[i],c[j],c[k]);
n++;
}
printf("n=%d",n);
}