Sunday, September 12, 2010

ASU101 HOMEWORK-MAX

public class ASU101MAX{


public static void main(String args[]){

int[] nums={4,-1,-2,6,0,1,-5,3,7};

Arrays.sort(nums);

System.out.println("Minimum = " + nums[0]);

System.out.println("Maximum = " + nums[nums.length-1]);

}

}

---------------------------------------------------------------------------------------------------
I never built any programming before, and I this is my best right now.

1 comment:

  1. The program is correct. However, you use a library function sort to find out the minimum value.

    I want you to write an algorithm that will find out the minimum value yourself, without using a library function.

    I do not need you to write it as a program. You can write in english using steps and loops.

    After that I still want you to argue about the correctness and finiteness of your algorithm.

    -Aviral

    ReplyDelete