Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- note
- description : "project application root class"
- date : "$Date$"
- revision : "$Revision$"
- class
- APPLICATION
- inherit
- ARGUMENTS
- create
- make
- feature {NONE} -- Initialization
- gcd(x , y :INTEGER):INTEGER
- local
- n,m :INTEGER
- do
- from
- m := x
- n := y
- invariant
- gcd(x , y) = gcd(n , m)
- until
- m = n
- loop
- if(m > n) then
- m := m - n
- else n := n - m
- end
- variant
- n + m
- end
- Result := m
- end
- make
- -- Run application.
- do
- a := 24
- b := 9
- print(gcd(a , b));
- end
- a,b:INTEGER
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement