#include <stdio.h>
// Function prototype for computing the greatest common divisor (GCD)
int gcd(int a, int b);
int main(void) {
// Declare and initialize two integers
int a = 12, b = 20;
// Print the GCD of the two numbers using the gcd function
printf("The GCD (greatest common divisor) of %d and %d is: %d\n", a, b, gcd(a, b));
return 0; // Exit the program
}
// Recursive function to compute the GCD
int gcd(int a, int b) {
// Base case: if b is 0, return a as the GCD
return b == 0 ? a : gcd(b, a % b); // Recursive call with b and remainder of a divided by b
}
/*
run:
The GCD (greatest common divisor) of 12 and 20 is: 4
*/