char *SortRGB(int r,int g,int b)
{
         char sort[5];
         strcpy(sort,"---");       
         if(g<r && g>b) strcpy(sort,"RGB");
         if(b<r && b>g) strcpy(sort,"RBG");
         if(b<g && b>r) strcpy(sort,"GBR");
         if(r<g && r>b) strcpy(sort,"GRB");
         if(r<b && r>g) strcpy(sort,"BRG");
         if(g<b && g>r) strcpy(sort,"BGR");
         return(sort); 
}

 

void masin()

{

    printf("%s\n\r",SortRGB(1,2,3));

 

}

 

 

실행

RGB