public class FourNumberGen {
    public static void main(String args[]){

        int i,j,k,l;
        System.out.println("With Repetition: ");
        for(i = 0; i<=9; i++){
            for(j = 0; j<=9; j++){
                for(k = 0; k<=9; k++){
                    for(l = 0; l<=9; l++)
                    {
                        System.out.print(i+""+j+""+k+""+l+" ");
                    }
                }
            }
        }

        for(i=0;i<10;i++){
            System.out.println(" ");
        }

        System.out.println("Without Repetition: ");
        for(i = 0; i<=9; i++){
            for(j = 0; j<=9; j++){
                for(k = 0; k<=9; k++){
                    for(l = 0; l<=9; l++)
                    {
                        if((i!=j)&(i!=k)&(i!=l)&(j!=k)&(j!=l)&(k!=l)){
                            System.out.print(i+""+j+""+k+""+l+" ");
                        }
                    }
                }
            }
        }


    }
}
