Write a C program to find common divisors between two numbers in a given pair.
#include <stdio.h>
int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  while (a && b) {
    a %= b;
    int c = a;
    a = b;
    b = c;
  }
  printf("GCD: %d\n", a + b);
  return 0;
}
Comments
Leave a comment