Sunday, September 12, 2010

Computing to the Max

I am not too familiar with programming yet, but here is my attempt in PSUEDO code:

BEGIN
   Prompt user to enter 4 numbers
   Use the variable i to be your current number
   Use equation n ( i + 1 )
   Make code to go through each number and compare i to the next number n
   If i<n 
      Go to next number and compare
   If i>n 
      Replace value of i with n and compare next number
   Loop until i is not replaced with n
END

This is probably not the greatest way to go about it but it made sense to me. Once I am more familiar with coding I can come back and make any necessary corrections.

1 comment:

  1. This is a very good attempt.
    1. I did not understand the use of equation n(i+1).
    2. Argue that this will terminate in finite time.
    3. Argue that this will always give the correct result.

    -Aviral

    ReplyDelete