Elementary Division 1990
1 TRIANGLES
Write a program that will print a triangle, similar to one below, with 
each side containing N symbols. This is a triangle of size N. 

Test your program for size N=7 and N=10.

Sample Run

WHAT IS THE SIZE? 7

*
**
* *
*  *
*   *
*    *
*******

2 WINNING STREAK
When you flip a coin you win every time it comes up heads and lose if 
it comes up tails. Assume you win on the first toss and continue 
flipping until you suffer a loss (tail). The WINNING STREAK is the 
number of wins until the first loss. 

For example  HHHT is a WINNING STREAK OF 3.

Write a program that will simulate the experiment that begins with a 
head (win) and continues flipping a coin until the first loss (tail) and 
report the length of the WINNING STREAK. Repeat the experiment 
10 times.

Sample Run

TRIAL		WINNING STEAK
 1 HT			1
 2 HHT			2
 3 HHHHHT		5
 4 HT			1
 5 HHT			2
 6 HHHHHHHHHT		9
 7 HT			1
 8 HHT			2
 9 HT			1
 10 HHHHT		4



3 MAKING CHANGE
When you buy something for less than one dollar and pay with a dollar 
bill you get change back. Usually the change is given back in the 
fewest number of coins. Write a program that will make change for 
any purchase of less than 1 dollar.  Express the change in the fewest 
number of coins possible.

The coins you have to work with are: half-dollar, quarter, dime, 
nickel, and penny.

100 cents = 	1 dollar	
50 cents = 	1 half-dollar 	
25 cents = 	1 quarter 	
10 cents = 	1 dime 	
5 cents = 	1 nickel
1 cent =	1 penny

Test your program with purchases of 23 cents and 51 cents.


Sample Run

What is your purchase in cents? 23

Your change is  
  1 half-dollar
  1 quarter(s)
  2 penny(ies)
  Thank you.



4 FRIDAYS IN 1990
What are the dates of all Fridays in 1990? Write a program that will 
find the dates of all Fridays in 1990. Print the dates in the form shown 
in the sample run. 
 
You need to know the following. 

1. The first Friday in 1990 occured on the 5th of January. 
2. Thirty days has September, April, June, and November, all the rest 
have 31 except for February which has 28 except in leap years when it 
has 29.
3. 1990 is not a leap year.

Note: To make it fair for everyone, you may not use any built-in date 
functions from your computer language.

Sample Run

The Fridays in 1990 occur on:
1/5, 1/12, 1/19, 1/26
2/2, 2/9, 2/16, 2/23
3/2, 3/9, 3/16, 3/23, 3/30
4/6, 4/13, 4/20, 4/27
5/4, 5/11, 5/18, 5/25
.......................
12/7, 12/14, 12/21, 12/28



5 WORD CHAIN
A Word Chain is a sequence of words which differ by one letter. The 
following sequence is a word chain  

MOM MOP MAP TAP TOP TOW

because each adjacent word differs by exactly one letter. 
Write a program that  accepts a sequence of words and tests whether it 
is word chain.

Test your program with the sequence HEAL, HEAD, DEAD, DEED, 
DEER, BEER and the sequence TWO, TOO, TOP, PIP, POP. After 
each sequence print whether it is or is not a word chain.


[You may enter your words in the program in DATA statements ]

Sample Run

MOM MOP MAP TAP TOP TOW
is a word chain.

TWO TOO TOP PIP POP
is not a word chain.


ICPSC 1990
Elementary Division Problems




