#include <stdio.h>
#include <conio.h>

int get_lcm(int a, int b)
{
  int p = 0, i, lcm;
  p = a * b;
  for (= 1; i <= p; i++)
  {
    if (((% a) == 0) && ((% b) == 0))
    {
      lcm = i;
      break;
    }
  }
  return lcm;
}
int main (int argc, char *argv[])
{
  int a, b, lcm;
  printf("\nEnter two numbers:");
  scanf("%d %d", &a, &b);
  lcm = get_lcm(a,b);
  printf("\nLCM of %d and %d is: %d", a, b, lcm);
}

About our authors: Team EQA

You have viewed 1 page out of 252. Your C learning is 0.00% complete. Login to check your learning progress.

#