Made it iterative
This commit is contained in:
		@@ -9,14 +9,18 @@
 | 
			
		||||
 | 
			
		||||
int gcd (int p, int q)
 | 
			
		||||
{
 | 
			
		||||
	int r;
 | 
			
		||||
 | 
			
		||||
	if ((r = p % q) == 0)
 | 
			
		||||
		return q;
 | 
			
		||||
	else
 | 
			
		||||
		return gcd (q, r);
 | 
			
		||||
	int r,t;
 | 
			
		||||
    while (q > 0)
 | 
			
		||||
    {
 | 
			
		||||
        r = p%q;
 | 
			
		||||
        p=q;
 | 
			
		||||
        q=r;
 | 
			
		||||
    }
 | 
			
		||||
    return p;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int main(){
 | 
			
		||||
    int a,b;
 | 
			
		||||
    scanf("%d%d",&a,&b);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user