087.三色球问题

举报
C语言与CPP编程 发表于 2022/05/01 23:22:12 2022/05/01
【摘要】 #include<stdio.h>void main(){ int i,j,count=0; clrscr(); puts("****************************************************************"); puts("* This pro...

  
  1. #include<stdio.h>
  2. void main()
  3. {
  4. int i,j,count=0;
  5. clrscr();
  6. puts("****************************************************************");
  7. puts("* This program is to solve Problem of Three Color Ball. *");
  8. puts("* The Problem is as follows: There are 12 balls in the pocket. *");
  9. puts("* Amony them, 3 balls are red,3 balls are white and 6 balls *");
  10. puts("* are black. Now take out any 8 balls from the pocket,how *");
  11. puts("* many color combinations are there? *");
  12. puts("****************************************************************");
  13. puts(" >> The solutions are:");
  14. printf(" No. RED BALL WHITE BALL BLACK BALL\n");
  15. printf("-----------------------------------------------------\n");
  16. for(i=0;i<=3;i++) /*循环控制变量i控制任取红球个数0 ̄3*/
  17. for(j=0;j<=3;j++) /*循环控制变量j控制任取白球个数0 ̄3*/
  18. if((8-i-j)<=6)
  19. printf(" %2d | %d | %d | %d\n",++count,i,j,8-i-j);
  20. printf("-----------------------------------------------------\n");
  21. printf(" Press any key to quit...");
  22. getch();
  23. }

文章来源: blog.csdn.net,作者:程序员编程指南,版权归原作者所有,如需转载,请联系作者。

原文链接:blog.csdn.net/weixin_41055260/article/details/124518761

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。