Guest User

Untitled

a guest
Jul 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. import java.util.*;
  2. public class Assignment9 {
  3.  
  4. public static void main(String[] args){
  5. Scanner scan=new Scanner(System.in);
  6. ArrayList<Integer> numbers=new ArrayList<Integer>();
  7. System.out.println("Enter the numbers to be processed: ");
  8. for (int i=0; i<100; i++){
  9. numbers.add(scan.nextInt());
  10. if (numbers.get(i) ==0)
  11. break;
  12. } // end for loop
  13.  
  14. System.out.print(findMin(numbers, 0, 1));
  15.  
  16. } // end main
  17.  
  18. public static int findMin(ArrayList<Integer> num, int index, int counter){
  19. System.out.println("Hello");
  20. if (counter>num.size()-1)
  21. if (num.get(index) > num.get(counter)){
  22. return 0;
  23. } else return num.get(index);
  24. else{
  25. if (num.get(counter)<num.get(index))
  26. return findMin(num, counter, counter++);
  27. else
  28. return findMin(num, index, counter++);
  29. }
  30.  
  31. } //end findmin
  32.  
  33.  
  34. } // end class
Add Comment
Please, Sign In to add comment