Three Homework Problems

March 22, 2016

I’m back home after visiting my daughter in Houston. The beginning-programming forums that I track, and the email that I receive (I can’t imagine what goes through the head of someone who sends me an email and tells me I must do their programming homework for them) suggests that we are in the part of the semester where beginning programmers have to write their first program. So, today we have three programs of the type that beginners need to write for their homework:

  1. Write a program that computes the sum of the integers in an array.
  2. Write a program that reverses the elements of an array.
  3. Write a program that sorts an array of integers, using insertion sort.

Your task is to assist our readers in completing their homework by writing the three programs described above. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.

Pages: 1 2