#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++)
10    {
11      if (((% a) == 0) && ((% b) == 0))
12      {
13        lcm = i;
14        break;
15      }
16    }
17    return lcm;
18  }
19  int main (int argc, char *argv[])
20  {
21    int a, b, lcm;
22    printf("\nEnter two numbers:");
23    scanf("%d %d", &a, &b);
24    lcm = get_lcm(a,b);
25    printf("\nLCM of %d and %d is: %d", a, b, lcm);
26  }
27 

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

 Vote 0

Similar topics related to this section

upper and lower 16bit of 32bit unsigned, Exchange variables, prime number, HCF, LCM, Pascals triangle, user defined types,

# C Programming Language (Prentice Hall Software)
# Let Us C Paperback - 2006 by Yashavant Kanetkar
# Understanding and Using C Pointers Core techniques for memory management
# Data Structures Using C and C++ Paperback - 1998
# Data Structures In C Paperback - August 11, 2008 by Noel Kalicharan