Senior Division 88
1. DIAMONDS 
Write a program that will ask the user for a whole number N between 
3 and 10 and print a pair of diamonds side-by-side each of size N.

SAMPLE RUN

ENTER A WHOLE NUMBER BETWEEN 3 AND 10: 4

            $       $
           $-$     $-$
          $-$-$   $-$-$
         $-$-$-$ $-$-$-$
          $-$-$   $-$-$
           $-$     $-$
            $       $

Test your program for N = 4 and N = 7.


2 PATTERNS
Examine the pattern of the numbers in the diamond of size 6 shown 
below.

           1	
        1    1
      1    2    1
    1   3    3    1
  1   4    6    4   1
1   5   10   10   5   1
  1   4    6    4   1
    1   3    3    1
      1    2    1
        1     1
           1
	
Figure out what the next size diamond  should be if it follows this 
same pattern. Write a program that will generate this diamond for any 
size from 1 to 10. Test your program for N=6 and N=10.


3  DIE TOSS
A die is a cube with 6 equal sides numbered {1, 2, 3, 4, 5, 6}. Pascal 
performed two experiments:

EX1:  Roll a die 4 times  and count the number of 6's.
EX2:  Roll a pair of dice 24 times and count the number double 6's.

Write a program that repeats EX1 and EX2  N times and compare 
which is more likely - getting a  6 in four rolls of a die or  getting a 
double 6 in 24 rolls of a pair of dice.

Test your program for N = 50.

Sample Run
ENTER THE NUMBER OF TRIALS: 50

The number of 6's in Ex1 REPEATED 50 times is:  34

The number of double 6's in EX2 REPEATED 50 times is: 56

THIS simulation IMPLIES THAT
getting TWO 6'S in EX2 is more likely than ONE SIX IN EX1. 


Note: Your experiment will have different numbers and could have a 
different result.



4. REVERSE 
Write a program that accepts a sentence and finds each group of words 
separated by the word "and" and arranges the group of words in 
reverse alphabetical order.

Sample Run
ENTER A SENTENCE

Input:
Alice and Bill and Andy have a bat and ball and glove.

Output:
bill and andy and alice have a glove and bat and ball. 


Test your program with the sentence used in the sample run and the 
sentence:
ONE AND TWO AND THREE LETS ROCK AND ROLL.



5 UNIQUE SUMS
Write a program that will find all the ways that a number between 2 
and 20 can be written as the sum of two or more positive numbers.

Test your program for N= 6 and 13.

Sample Run
ENTER A WHOLE NUMBER BETWEEN 2 AND 9 : 6

THE UNIQUE SUMS ARE:
6 = 1 + 5
6 = 2 + 4
6 = 3 + 3
6 = 1 + 1 + 4
6 = 1 + 2 + 3
6 = 2 + 2 + 2
6 = 1 + 1 + 1 + 3
6 = 1 + 1 + 2 + 2 
6 = 1 + 1 + 1 + 1 + 2
6 = 1 + 1 + 1 + 1 + 1 + 1 
TOTAL NUMBER OF UNIQUE SUMS = 10

Note:
Rearrangement of the same numbers are not counted as different sums.
Thus the sum  6 = 4 + 1 + 1  is not considered different from  6 = 1 + 
1 + 4.

Your arrangement of sums may be different than the sample run.

	ICPSC 1988
	Senior Division Problems


