diff --git a/Assignment 5/main.c b/Assignment 5/main.c index 8883acc..6b474e0 100644 --- a/Assignment 5/main.c +++ b/Assignment 5/main.c @@ -9,14 +9,14 @@ int gcd (int p, int q) { - int r,t; - while (q > 0) + int r; + while (q > 0) /* Loops until the remainder is 0 */ { - r = p%q; - p=q; - q=r; + 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 */ } - return p; + return p; /* Returning p after the loop finishes */ }