text: int primitiveGCD(int A, int B){\n  int g;\n  if (A < 0 || B < 0 ) return -1; /*error*/\n  g = B;\n  if (A < B){B = A; A = g; g = B;}\n  /* if g is not a factor of either it will return true value and it will continue looping */\n  while(A%g || B%g)g--;\n\n  return g;\n}\n\nYou can at least write the program. Cheating doesn't help you learn.