CPPForSchool.com: Flow of Control Set 2: Assignment 8

8. Write a program to calculate HCF of Two given number. 


Before I began coding, I had to confirm the meaning of HCF.  According to my research, HCF stands for Highest Common Factor or another well-known synonym would be GCD or Greatest Common Denominator.  Ultimately, I need to create a program that accepts two integers and then calculates the Greatest Common Denominator for both values.

For example, if the numbers inputted were 6 and 12, the HCF/GCD would be 6 because 6 can divide into itself and 12.

Below is my source and test outputs.  Of course, I have also included the sample source and output for comparison.












Comments

Popular posts from this blog

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 8

CPPForSchool.com: Array - Single Dimension Set 1 Assignment 6

CPPForSchool.com: Variable, Operator & Expression Set 1: Assignment 7