Check out example codes for "how to find hcf in c++". It will help you in understanding the concepts better.

Code Example 1

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

Learn ReactJs, React Native from