CIS 71 (section 1): Homework 6

Handed out: 2/25/97
Due: by 2:30pm on 3/4/97
Email program to btrianta@thunder.temple.edu

Write a program that prompts the user to enter a sequence [terminated by 0] of at least 10 positive integers. Then

  1. on separate lines it prints out the sequence, the sequence minus first and last element, sequence minus first two and last two elements, ...
  2. It reverses the sequence.
  3. It does again what done in step 1.

As a comment at the beginning of your program you should do a case analysis for this problem: problem statement, analysis, design, and testing.

For example, if I entered the sequence 1,2,3 ,4 5,6,7,8,9,10, I should print out

   1  2  3  4  5  6  7  8  9 10
   2  3  4  5  6  7  8  9
   3  4  5  6  7  8
   4  5  6  7
   5  6
  10  9  8  7  6  5  4  3  2  1
   9  8  7  6  5  4  3  2
   8  7  6  5  4  3
   7  6  5  4
   6  5 
I would be happier though if your output looked as follows:
   1  2  3  4  5  6  7  8  9 10
      2  3  4  5  6  7  8  9
         3  4  5  6  7  8
            4  5  6  7
               5  6
  10  9  8  7  6  5  4  3  2  1
      9  8  7  6  5  4  3  2
         8  7  6  5  4  3
            7  6  5  4
               6  5