next up previous
Next: Mathematical Magic Up: Control StructureIntrinsics and Previous: Control StructureIntrinsics and

 

The `Triangle Program'

Write a program to accept three (INTEGER) lengths and report back on whether these lengths could define an equilateral, isosoles or scalene triangle (3, 2 or 0 equal length sides) or whether they cannot form a triangle.

Demonstrate that the program works by classifying the following:

  1. (1, 1, 1)
  2. (2, 2, 1)
  3. (1, 1, 0)
  4. (3, 4, 5)
  5. (3, 2, 1)
  6. (1, 2, 4)


next up previous
Next: Mathematical Magic Up: Control StructureIntrinsics and Previous: Control StructureIntrinsics and

Adam Marshall ©University of Liverpool, 1996
Wed Oct 9 17:39:48 BST 1996