天天看點

題目:有1、2、3、4四個數字,能組成多少個互不相同且無重複數字的三位數?都是多少?

/*
【程式11】題目:有1、2、3、4四個數字,
能組成多少個互不相同且無重複數字的三位數?都是多少?
*/
class Test11 {
	public static void main(String[] args) {
		int count = 0;
		for(int i=1;i<5;i++){
			for(int j=1;j<5;j++){
				for(int k=1;k<5;k++){
					if(i!=j&&i!=k&&j!=k){
						System.out.print((i*100+j*10+k)+" ");
						count++;
						if(count%5==0){
							System.out.println();
						}
					}
				}
			}
		}
		System.out.println();
		System.out.println("滿足條件的數字一共有"+count+"個");
	}
}
           

輸出結果:

題目:有1、2、3、4四個數字,能組成多少個互不相同且無重複數字的三位數?都是多少?

繼續閱讀