Bookmark and Share

Liens sponsorisés

Seniors Level 1 Print E-mail
Written by Administrator   
Saturday, 09 May 2009 23:36

1 TOWER BUILDING

With the * symbol and the PRINT command any tower can be built.

In the towers shown below, the size (number of rows) of the second triangle is always twice the size of the first triangle.

Write a program to generate the following towers? Your program should ask for the size of the top triangle.

Test your program for N= 4 and 7.


Sample Run

ENTER TOP SIZE : 4

*

***

*****

*******

*

***

*****

*******

*********

***********

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

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

 

2 SAFE CRACKING

To open a safe requires knowing three single digits (0-9). For example, the three digits 5 - 4 - 9 are a combination. A secret message has been found that says, " the combination is the last three digits (100's, 10's and 1's) of

2777

Write a program to crack the safe. Print your answer in the form X - Y - Z.


Sample Run

THE COMBINATION IS ? - ? - ?

 

3 BIRTHDAY OF THE WEEK

"On what day of the week were you born?" I asked this question of a group of 14 people and received six different answers. I expected to get seven different answers -- one for each day of the week (MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, AND SUNDAY).

Call the day of the week you were born your BIRTHDAY OF THE WEEK.

Assume that every day of the week is equally likely to be a birthday of the week. What would the results be if you asked a group of 14 people to tell you their birthday of the week? How many different birthdays of the week would you expect from 14 people chosen at random? 5? 6? 7? What are the chances that all seven days would be chosen?

Write a program to simulate the experiment of picking 14 birthdays of the week from the 7 days of the week. Repeat the experiment 100 times and use the results to estimate the percentage of times that out of 14 people, every day of the week (all seven days) is somebody's BIRTHDAY OF THE WEEK.


Sample Run

AN ESTIMATE FOR THE PERCENTAGE OF TIMES THAT A GROUP OF 14 PEOPLE

WILL HAVE ALL 7 DAYS OF THE WEEK AS BIRTHDAYS OF THE WEEK IS ? %.

 

4 WORD SEARCH

If you look carefully at the puzzle below you will recognize certain words hidden in rows of the puzzle. You job is to program the computer to find the words for you.

Write a program to find the words listed below hidden in the puzzle. You may assume that all words appear in rows (ACROSS) and read from left to right.

Puzzle Words

H A F B T H E W THE BEST CONTEST

J B S Y O Y J S

L G B E S T Y U

T S C O L T E D

J T F S D O W L

W C O N T E S T

Your program should print the word, the row, and the column where it begins.


Sample Run

ROW COLUMN

THE 1 5

BEST 3 ?

CONTEST ? ?

 

5 NUMBER SQUARES

The numbers in the square below reveals a pattern which is called a NUMBER SQUARE for N=5.

1 10 9 7 4

2 6 8 6 3

3 7 10 5 2

4 8 11 13 1

5 9 12 14 15

Discover this pattern and write a program to generate NUMBER SQUARES for any size (number of rows) N between 1 and 99.

Test your program for N=4 and 9.


Sample Run

ENTER A SIZE BETWEEN 1 AND 9: 3

1 3 2

2 4 1

3 5 6

HINT The sum of the integers from 1 to N, (1+2+3+ ...+ N), equals N*(N+1)/2.


 

 

Liens sponsorisés