how to find hcf in c++

// C++ program to find GCD of two numbers 
#include <iostream> 
using namespace std; 
// Recursive function to return gcd of a and b 
int gcd(int a, int b) 
{ 
	if (b == 0) 
		return a; 
	return gcd(b, a % b); 
	
} 

// 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; 
} 

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
hcf of number in cpp how to find the hcf in c++ to find the hcf c++ c++ hcf() hcf function in c++ function for hcf c++ find hcf in cpp hcf using function c++ gcd in cpp c++ program to find hcf of n numbers find hcf 0f n numbers c++ program find hcf c++ program hcf in cpp lcm and hcf of two numbers in cpp wap to find gcd of two numbers in c++ hcf code in cp write a c++ program to find the GCD of two numbers in c++ psudo code for hcf of a number using iteration psudo code for fhcf of a number using iteration gcd of tow nos in cpp how to find the hcf of two numbers in c++ GCD of N1 and N2 c++ gcd of two numbers in c++ highest common factor function c++ gcd function cpp gcd() of two numbers in cpp calculate greatest common divisor c++ hcf using cpp hcf using recursion c++ c++ code to find hcfof all numbers in an array lcm and hcf c++ program c++ that reads two integers and then finds and prints the HCF/GCD using for loop. cpp referance gcd of two numbers program to find hcf of two numbers in c++ hcf of number cpp gcd code c++ c++ code to find hcf of two numbers greatest common divisor c++ program looping cpp gcf gcd code in c++ c++ program to calculate gcd gcd of 20 50 in c++ hcf c++ hcf code cpp write a code to find hcf of 2 numbers c++ how to find hcf cpp hcf of 2 number c++ gcd program in cpp c++ how to find hcf find gcd c++ how to find gcd in c++ gcd program in c++ find gcd in cpp gcd c++ not using loop gcd c++ c++ code for finding hcf c++ program for hcf of two numbers hcf cpp hcf of two numbers in c++ hcf in c++ program hcf of two nos code in c++ gcd code 18446744073709551615 find C++ hcf in c++ how to find hcf in c++
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source