KE06603 Engineering
Programming
Lecture 4: Algorithm
Design
"Composing computer programs to solve
scientific problems is like writing poetry.
You must choose every word with care and
link it with the other words in perfect
syntax. There is no place for verbosity or
carelessness. To become fluent in a
computer language demands almost the
antithesis of modern loose thinking. It
requires many interactive sessions, the
hands-on use of the device. You do not
learn a foreign language from a book,
rather you have to live in the country for
year to let the language become an
automatic part of you, and the same is true
for computer languages. "
-
James Lovelock
Exercise 1
Write an algorithm to generate the sum of the
Fibonacci numbers between 1 and 100. Print
the numbers and their sums.
Exercise 2
Write an algorithm to input a set of integer
numbers, count and sum the positive numbers,
and also count and sum the negative numbers.
It should then print the count and sum of all
positive numbers and the count and sum of all
negative numbers.
Exercise 3
Design an algorithm to find the positive square
root of any positive numbers using bisection
method.