tags:

views:

47

answers:

1

here is code print number in decreasing order

import java.util.*;
public class select {
public static   void Select(int m,int n){

Random  r=new Random();

 if (m>0)
if (r.nextInt(0x3fff8001) % n <m ){
  System.out.println(n-1);
  Select(m-1,n-1);
}
 else{
   Select(m,n-1);
}

}

public static void main(String[]args){

int m=35;
 int n=200;
 Select(m,n);
}
}

and question is how to changes code such that print number in increasing order? please help

A: 

Reverse the order of recursion versus printing.

Jerry Coffin
@Jerry Coffin how?
any idea? please help
Yes, I have an idea. Do you? Do you know where the code you posted prints something out? Do you know where it recurses? Do you know what recursion is?
Jerry Coffin