#include
using namespace std;
int gcd(int a,int b){
if (b==0){ ///base case ;
return a ;
}else if(b>a){
swap(a,b);
}
return gcd(b,b%a); //recursive case ;
}
int main(){
int a,b;
cin >> a >> b;
cout<<gcd(a,b);
}
what is worng with the code …
2 test case is showing wrong answer …
if i remove the swaping code then both test cases are showing wrong-answer
else if(b>a){
swap(a,b);
}