Tuesday, October 11, 2011

10/9

The semester started on Monday last week.

Programming 2: we started on recursion in the first week, its a rather simple concept, Its more/less a min loop, but instead of starting at the first case, it starts with the last case. An example is in the previous post; what we wanted to do for that assignment is find the greatest common divisor.
We first had to define the largest and smallest numbers in the list to find the modulo, the if statement asks "if this "smaller" number is bigger than this "larger" number then redefine "larger" and smaller(smaller and larger being the parameters) we then put larger against smaller for the modulo, if the answer we got was 0 we returned it as is, if it wasnt, we redefined larger to smaller and smaller to rem and then returned it.





No comments:

Post a Comment