Half of assignment 6

This commit is contained in:
Shaquille K. Soekhlal
2019-09-13 10:27:00 +02:00
parent 395564a57a
commit 1f11ed2910
3 changed files with 59 additions and 2 deletions

View File

@ -10,8 +10,7 @@
int gcd (int p, int q)
{
int r;
while (q > 0) /* Loops until the remainder is 0 */
{
while (q > 0){ /* Loops until the remainder is 0 */
r = p%q; /* Calculate remainder */
p=q; /* Storing the value of q in p */
q=r; /* Setting q to the value of the remainder to calculate new remainder in the next iteration */