Question: (write in c++ program) Greatest Common Factor(GCF) Write a complete program that calculates GCF. It should include asking user to input 2 integer numbers. The

(write in c++ program)
Greatest Common Factor(GCF)
 Write a complete program that calculates GCF. It should include asking user to input 2 integer numbers. The output should be the GCF of these 2 input numbers. For example, GCF(45,35) = 5. Declare the GCF as a function out of main function, and it should be called in the main function. There is a theory you have to know and use it in the program: GCF(A,B) = GCF(B, A%B), when A%B = 0, the answer is the final value of B. For example: GCF(A,B) A%B GCF(45,35) 10 => GCF(35,10) 5 => GCF(10,5) 0 ==> GCF(45,35) = 5 //this is the GCF function. Problem_1: Explain why this theory works to find greatest common factor of 2 numbers. You can do a research online and then write a short version to explain your understanding. Problem_2: Write a complete code which can satisfy all the requirements above. 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!