hi,
pls have a look ,it is showing core dumped
Gcd core dumped
Hi u have to check for the last modulo to be equal to 0 not 1 since at the end gcd is going to divide a and give modulo 0.
Just a made a few changes please look.
#include<iostream>
using namespace std;
long long int gcd(long long int a,long long int b)
{
if(a==0)
return b;
return gcd(b%a,a);
}
int main() {
long long int a,b,c;
cin>>a;
cin>>b;
if(a>b)swap(a,b);
c=gcd(a,b);
cout<<c;
return 0;
}