(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...






(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




This problem has been solved!




















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.



Sep 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here