```
/*I have coded this but it is not working fine it kept saying "Segmentation fault" and i can't track it down, can someone help me on this i want it badly!*/
#include<iostream>
using namespace std;
int k=0;
void gcd(int a, int b);
void gcd(int a, int b)
{
static int temp=b;
int buffer[20],buffer1[20],j,i;
for(i=0; i<temp; i++)
{
if(b>0&&temp%b==0)
{
buffer[k]=b;
k++;
gcd(a,b-1);
}
else
gcd(a,b-1);
}
for(i=0; i<temp; i++)
{
if(a%buffer[i]==0)
buffer1[i]=buffer[i];
}
int GCD = buffer1[0];
for(i=0; i<temp; i++)
{
if(buffer1[i]>GCD)
GCD=buffer1[i];
}
cout<<"This is just the gcd"<<GCD;
}
int main()
{
int num,num2;
cout<<"Enter the first number\n";
cin>>num;
cout<<"Enter the second number\n";
cin>>num2;
gcd(num,num2);
return 0;
}
```

0

*Edited
by book_worm*: n/a