Question: Consider the algorithm: Algorithm Input: A natural number q and a natural number m with q > m . ( 1 ) repeat - -

Consider the algorithm:
Algorithm
Input: A natural number
q
and a natural number
m
with
q
>
m
.
(1) repeat
--(a) let
r
:=
q
mod
m
--(b) let
q
:=
m
--(c) let
m
:=
r
(4) until
r
=
0
(5) return
q
What does the algorithm return when the input is
q
:=
284
and
m
:=
80
?
What does the algorithm return when the input is
q
:=
1144
and
m
:=
80
?
What does the algorithm return when the input is
q
:=
302
and
m
:=
80
?
What does the algorithm return when the input is
q
:=
85
and
m
:=
80
?
What does the algorithm return ?
A. The remainder of the division of
q
by
m
.
B.
m
q
C. The greatest common divisor of
m
and
q
D. The quotient of the division of
q
by
m
.
E.
(
m
)
q
F.
m
G.
q
+
m
H. The difference of the sum of the first
q
natural numbers and
m
.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!