Due by 5 PM, Friday April 3, 1998
All the questions this week ask for programs in C. Perfection will not be expected, but please try to write really good C. Consult the handy table for differences between Pascal and C.
1. Write a C program that will compute the sum of all the non-negative integers in a 64-element integer array called A. Use a while loop to go through the array. Put the answer in an integer variable named answer.
2. Now solve the same problem as question 1, but use a for loop instead of a while.
3. Write a program in C to find the biggest and smallest integers in a 100-element integer array named Ralph, and then compute the remainder of the biggest divided by the smallest. The C operator % is just what you need: m % n is the remainder of m divided by n. First, do this by using two different loops, one for the biggest and one for the smallest. Use either for or while loops. Put the answer in a variable named gretchen.
4. Now solve the same problem as question 3, but use just one loop.