Hi for this problem we have to do it in DrRacket Not Java bu

Hi. for this problem we have to do it in DrRacket (Not Java but like Lisp-Scheme family)

The famous computer scientist, Edsger Dijkstra, made the
following observations for m and n >= 1:

1. If m = n, then the greatest common divisor of m and n is m.
2. If m > n, then the greatest common divisor of m and n is
   the greatest divisor of m-n and n.

Based on these observations, implement a function to compute
the greatest common divisor of two given numbers >= 1. Follow
all the steps of the design recipe.

and write the termination argument and check-expect.

Solution

Racket is functional programming which uses prefix notation

(define (gcd a b)

( if ( = b 0)

a

(gcd b (modulo a b))))

This function will return the gcd of the given two numbers a,b ... it uses recursion and if b=0 returns a or else it will make a call to the same function with the parameters b, a%b .....

Hi. for this problem we have to do it in DrRacket (Not Java but like Lisp-Scheme family) The famous computer scientist, Edsger Dijkstra, made the following obse

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site