三色球问题

#include <stdio.h>

int main()
{
	int a;			//红
	int b;			//白
	int c;			//黑
	int n = 1;		//取法个数
	printf("    红   白   黑\n");
	
	for (a = 0; a <= 3; a++)
	{
		for (b = 0; b <= 3; b++)
		{
			c = 8 - a - b;
			if (c <= 6)printf("%2d%3d%5d%5d\n", n++, a, b, c);
		}	
	}
	return 0;
}

posted @ 2023-04-27 21:57  258333  阅读(25)  评论(0编辑  收藏  举报