1234567选择3个数字组合
public class cnk { public static void main(String[] args) { int[] n = new int[]{1,2,3,4,5,6,7}; int i0 = 0; int i1; int i2; while(i0<n.length){ i1=i0+1; while(i1<n.length){ i2=i1+1; while(i2<n.length){ System.out.println(""+n[i0]+n[i1]+n[i2]); i2++; } i1++; } i0++; } } }
123 124 125 126 127 134 135 136 137 145 146 147 156 157 167
234 235 236 237 245 246 247 256 257 267
345 346 347 356 357 367
456 457 467
567