数据加载中……

2008年8月23日

排列

有四个数
1,8,7,5。
排列有多少种 分别打印出来。

public class shizipailie{
    
public static void main(String[] args){
        
int a,b,c,d;
        
for(a=1;a<5;a++){
            
for(b=1;b<5;b++){
                
for(c=1;c<5;c++){
                    
for(d=1;d<5;d++){
                        
if(a!=b&&a!=c&&a!=d&&b!=c&&c!=d&&b!=d){
                            System.out.print(
"|"+a+" "+b+" "+c+" "+d+"|");
                        }

                    }

                }

            }

            System.out.println();
        }

        System.out.println(
"============================================");
        System.out.println(
"大小循环的正式使用 加条件的约束==即成   :");
        System.out.println(
"计算数列的排列组合   (4*3*2*1) :");
        System.out.println(
"============================================");
        
int [] abc={5,7,6,4};
        
for(int j=0;j<abc.length;j++){
            
for(int k=0;k<abc.length;k++){
                
for(int i=0;i<abc.length;i++){
                    
for(int l=0;l<abc.length;l++){
                        
if(j!=k&&j!=i&&j!=l&&k!=i&&k!=l&&i!=l){
                            System.out.print(
"|"+abc[j]+" "+abc[k]+" "+abc[i]+" "+abc[l]+"|");
                        }

                    }

                }

            }

            System.out.println();
        }

    }

}

posted @ 2008-08-23 01:19 月下峰 阅读(78) | 评论 (0)编辑 收藏

2008年8月21日

打印质数 ——我的编写过程

     摘要:   阅读全文

posted @ 2008-08-21 18:47 月下峰 阅读(254) | 评论 (0)编辑 收藏
乘法表打印 ----我的编写过程

     摘要:   阅读全文

posted @ 2008-08-21 18:40 月下峰 阅读(147) | 评论 (0)编辑 收藏
仅列出标题