c++ programme for finding the hcf of 2 inputted numbers..
pls help
Answers
Answered by
0
Answer:
hi hello how are you
Explanation:
please Mark brainliest
Answered by
1
using namespace std;
// Recursive function to return gcd of a and b
int gcd(int a, int b)
{
// Everything divides 0
if (a == 0)
return b;
if (b == 0)
return a;
// base case
if (a == b)
return a;
// a is greater
if (a > b)
return gcd(a-b, b);
return gcd(a, b-a);
}
// Driver program to test above function
int main()
{
int a = 98, b = 56;
cout<<"GCD of "<<a<<" and "<<b<<" is "<<gcd(a, b);
return 0;
}
Similar questions
Math,
1 month ago
Physics,
1 month ago
History,
1 month ago
Political Science,
3 months ago
Economy,
9 months ago