Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Knowledge Discovery In Databases

Authors: Gregory Piatetsky-Shapiro, William Frawley

1st Edition

ISBN: 0262660709, 978-0262660709

More Books

Students also viewed these Databases questions