Question: Program in C : Greatest Common Divisor (Brute Force Method) A file contains an unknown number of pairs of positive integer values. One pair per

Program in C : Greatest Common Divisor (Brute Force Method)

A file contains an unknown number of pairs of positive integer values. One pair per line. You are guaranteed that each member of the pair of numbers will be a positive integer. Your program will learn the name of the file from argv[1]. You are to write a program that will find the greatest common divisor for each pair of numbers.

For this program, you should use a brute force method that will use a loop that will start at the minimum of the two numbers and count down by 1 until the first common divisor of both numbers is found. I do not want you to use Euclids method on this one.

What is the greatest common divisor of 50 and 10?

What is the greatest common divisor of 48 and 16?

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!