Source Code:
#include <bits/stdc++.h>
int GCD(int,int); ///Function Prototype
int main()
{
int a,b,result;
while(scanf(“%d %d”,&a,&b)==2)
{
result=GCD(a,b); ///Function Calling
printf(“GCD of %d and %d is: %d\n”,a,b,result);
}
return 0;
}
int GCD(int p,int q) ///Function/Recursion Definition
{
if(q==0)
return p;
else if(p>q)
return GCD(q,p);
else
return GCD(p,q%p);
return -1;
}
Definitely, what a great blog and informative posts, I will bookmark your blog.All the Best!