1.2 借书方案知多少
#include<stdio.h> main() { int a,b,c,i=0; printf("A,B,C三人所选的书号分别是:\n"); for(a=1;a<=5;a++) for(b=1;b<=5;b++) for(c=1;c<=5;c++) if(a!=b&&a!=c&&c!=b) { printf("A%2d B:%2d C:%2d ",a,b,c); i++; if(i%4==0) printf("\n"); } printf("共有%d种有效借阅方法\n",i); }