Answer to Question #265264 in C for Rosie

Question #265264

Write a C program to find common divisors between two numbers in a given pair.

1
Expert's answer
2021-11-13T02:16:15-0500
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS