1.袋中有6红球 3黄球 3绿球,从中取6个球,求所有拿到球的颜色的可能 c(12,6)
1 #include<stdio.h> 2 3 int main(int argc, char** argv) 4 { 5 int red = 6; 6 int yellow = 3; 7 int green = 3; 8 int i = 0; 9 int j = 0; 10 11 for ( i = 0; i <= yellow; i++) 12 { 13 for (j = 0; j <= green; j++) 14 { 15 //if () 16 printf("red:%d, yellow:%d, green:%d ", (6-i-j), i, j); 17 } 18 } 19 20 }