18.10.2014 Views

Object-oriented Software in Ada 95

Object-oriented Software in Ada 95

Object-oriented Software in Ada 95

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Ada</strong> <strong>in</strong>troduction: Part 1 37<br />

3.14 Exercises<br />

Construct the follow<strong>in</strong>g programs:<br />

• Numbers<br />

A program to pr<strong>in</strong>t the first 20 positive numbers (1, 2, 3, etc.).<br />

• Times table<br />

A program to pr<strong>in</strong>t out the 8 times table so that the output is <strong>in</strong> the follow<strong>in</strong>g form:<br />

8 * 1 = 8<br />

8 * 2 = 16<br />

8 * 3 = 24<br />

. . .<br />

8 * 12 = 96<br />

• Series<br />

A program to pr<strong>in</strong>t out numbers <strong>in</strong> the series 1 1 2 3 5 8 13 ... until the last term is greater then 10000.<br />

• Character table<br />

A program to pr<strong>in</strong>t the characters represented by the numbers 32 to 126.<br />

H<strong>in</strong>t:<br />

If a variable number is of type Integer then Character'Val(number) will deliver the<br />

character which is represented <strong>in</strong>ternally by the value conta<strong>in</strong>ed <strong>in</strong> number.<br />

• Table<br />

A program to pr<strong>in</strong>t out the square, cube and 4th power of the first 15 positive numbers.<br />

© M A Smith - May not be reproduced without permission

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!