Untitled

 avatar
user_7016102
plain_text
a month ago
333 B
1
Indexable
Never
//LAB 8
#include<iostream>
using namespace std;
int gcd(int a, int b)
{
	if(b==0){
		return a;
	}
	else if(b>a)
	{
		return gcd(a,b%a);
	}
	else{
		return gcd(b,a%b);
	}
}
int main()
{
	int a,b;
	cout<<"Enter a and b for GCD : "<<endl;
	cin>>a>>b;
	cout<<"The GCD of ("<<a<<b<< ") is :"<<gcd(a,b);
	return 0;
}
Leave a Comment