Added comments

This commit is contained in:
Shaquille Soekhlal 2019-09-11 11:30:23 +02:00
parent 6dfc92e3dc
commit fc59dd3913

View File

@ -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 */
}