Abstract
Let us follow the steps of development of a simple program and thereby explain some of the fundamental concepts of programming and of the basic facilities of Modula. The task shall be, given two natural numbers x and y, to compute their greatest common divisor (gcd). The mathematical knowledge needed for this problem is the following:
-
1.
if x equals y, x (or y) is the desired result
-
2.
the gcd of two numbers remains unchanged, if we replace the larger number by the difference of the numbers, i.e. subtract the smaller number form the larger one.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 1988 Springer-Verlag Berlin Heidelberg
About this chapter
Cite this chapter
Wirth, N. (1988). A First Example. In: Programming in Modula-2. Text and Monographs in Computer Science. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-83565-0_2
Download citation
DOI: https://doi.org/10.1007/978-3-642-83565-0_2
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-83567-4
Online ISBN: 978-3-642-83565-0
eBook Packages: Springer Book Archive