Question: Write a program gcd that computes the greatest common divisor (GCD) of two integers. gcd takes two arguments, both integers, and prints the largest integer

Write a program gcd that computes the greatest common divisor (GCD) of two integers. gcd takes two arguments, both integers, and prints the largest integer that evenly divides both arguments.

Usage

$ ./gcd 12 20

4

$ ./gcd 1011 51

3

Notes You may assume that the arguments are positive integers that can be represented as (signed) int values.

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!