#include <stdio.h>
int main() {
  int n1, n2, i1, i2, t, gcd, lcm;

  printf("Enter two integers\n");
  scanf("%d%d", &i1, &i2);

  n1 = i1;
  n2 = i2;

  while (n2 != 0) {
    t = n2;
    n2 = n1 % n2;
    n1 = t;
  }

  gcd = n1;
  lcm = (i1*i2)/gcd;

  printf("Greatest common divisor of %d and %d = %d\n", i1, i2, gcd);
  printf("Least common multiple of %d and %d = %d\n", i1, i2, lcm);

  return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: