#include
#include
using namespace std;
int main()
{
int N1,N2,c;
cin>>N1>>N2;
c= __gcd(N1, N2);
std::cout << c << std::endl;
}
#include
#include
using namespace std;
int main()
{
int N1,N2,c;
cin>>N1>>N2;
c= __gcd(N1, N2);
std::cout << c << std::endl;
}
@abhishekpandeybhu_da87a9e0d2c73079, this is also correct also u can use recursive formula but only if u have read recursion refer here : https://www.geeksforgeeks.org/program-to-find-hcf-highest-common-factor-of-2-numbers/?ref=rp
Even u can do iteratively but that ma fail for large no in time complexity , refer here https://www.programiz.com/cpp-programming/examples/hcf-gcd
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.