Question: Please create a C file that can compile with GCC GCD: Write a C program to recursively calculate the Greatest Common Divisor (GCD of two
GCD: Write a C program to recursively calculate the Greatest Common Divisor (GCD of two positive integers. The GCD is the largest positive integer that is able to divide each of the given integers. For instance, the GCD of 8 and 12 is 4. For more details on GCD, please see https: //en.wikipedia.org/wiki/Greatest_common_divisor. Your program should take input from the standard input and print the output in the standard output. The precise format of the input is given below. The first line of the input is an integer T indicating the number of test cases your program should handle. T test cases will follow. For each of the T test cases, the input will contain two space-separated positive integer n_1 and n_2 such that n_1 and n_2 will both fit into a 32-bit integer (i.e., int). The output for a particular n_1 and n_2 is their GCD followed by a newline. Sample input: 2 8 12 27 18 Expected output of the same input: 4 9
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
