Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Assignment9 {
- public static void main(String[] args){
- Scanner scan=new Scanner(System.in);
- ArrayList<Integer> numbers=new ArrayList<Integer>();
- System.out.println("Enter the numbers to be processed: ");
- for (int i=0; i<100; i++){
- numbers.add(scan.nextInt());
- if (numbers.get(i) ==0)
- break;
- } // end for loop
- System.out.print(findMin(numbers, 0, 1));
- } // end main
- public static int findMin(ArrayList<Integer> num, int index, int counter){
- System.out.println("Hello");
- if (counter>num.size()-1)
- if (num.get(index) > num.get(counter)){
- return 0;
- } else return num.get(index);
- else{
- if (num.get(counter)<num.get(index))
- return findMin(num, counter, counter++);
- else
- return findMin(num, index, counter++);
- }
- } //end findmin
- } // end class
Add Comment
Please, Sign In to add comment