C++ Program to Calculate HCF of Two Numbers using Functions

By | December 25, 2016

HCF of Two Numbers using Functions 


Write a C++ Program to Calculate HCF of Two Numbers using Functions . Here’s simple C++ Program to Calculate HCF of Two Numbers using Functions in C++ Programming Language.


HIGHEST COMMON FACTOR (H.C.F)


  • The HCF of two (or more) numbers is the largest number that divides evenly into both numbers.
  • In other words the H.C.F is the largest of all the common factors.
  • The common factors or of 12 and 18 are 1, 2, 3 and 6.
  • The largest common factor is 6, so this is the H.C.F. of 12 and 18.
  • It is very easy to find a H.C.F. of small numbers, like 6 and 9 (it is 3) or 8 and 4 (it is 4).
  • The best way is to keep finding the factors of the smaller number, starting from the largest factor. The first factor of the smaller number that is also a factor of the larger number is a H.C.F.

Here is source code of the C++ Program to Calculate HCF of Two Numbers using Functions. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.


SOURCE CODE : :



Output : :



Above is the source code for C++ Program to Calculate HCF of Two Numbers using Functions which is successfully compiled and run on Windows System.The Output of the program is shown above .

If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.


Thanks for reading the post….

Leave a Reply