Added comments
This commit is contained in:
parent
6dfc92e3dc
commit
fc59dd3913
@ -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 */
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user