Hello Programmers,

To use this medium effectively, refresh this page every 10 min or so for as long as the lecture is in session, since I will update this post time and again. You can also try coming in on NetMeeting (if that works) by reading the instructions on our web.

Here you go:

Using arrays makes life better while computing large data. So try this logic

To use this medium effectively, refresh this page every 10 min or so for as long as the lecture is in session, since I will update this post time and again. You can also try coming in on NetMeeting (if that works) by reading the instructions on our web.

Here you go:

- Given three numbers a, b & c you can find out which is the largest of them by comparing each number with the others in turn. Can you do this in a program? The logic goes like this:

Now what will you do if you need to find the largest among say a 100 numbers??? Can the same logic work?

1. Take a, b, c from the user 2. Is a > b and c ... then a is largest 3. Is b > a and c ... then b is largest 4. If none of the above, then c is largest

Using arrays makes life better while computing large data. So try this logic

- Take the numbers as inputs into an array having an appropriate size, say 'n'
- define an arbitrary high value - max - maybe 0
- Run loop from 0 to n
- In each iteration, check if the i'th element of the array is larger than max
- If the ith element is bigger than max, change the value of max to the ith element
- at the end of the loop you get your value in max

Will give you more assignments with arrays and using the File commands by the evening. Try them over the weekend.

## Comments

## Post a Comment