Least Common Multiple
The least common multiple (LCM), which is also known as the least
common denominator (LCD) in fractions, of two or more integers is the
smallest integer that is a common multiple (denominator) of all the given
integers.
THE PROGRAM IS TO FIND GCD AND LCM :
#include<conio.h>
void main()
{
int m,n,gcd,lcm,rem,p,q;
printf("enter the no m and n \n");
scanf("%d%d",&m,&n);
p=m;
q=n;
while(n!=0)
{
rem=m%n;
m=n;
n=rem;
}
gcd=m;
printf("\n gcd of %d and %d is = %d\n",p,q,gcd);
lcm=(p*q)/gcd;
printf("\n lcm of %d and %d is = %d\n",p,q,lcm);
getch();
}
Just copy and paste into your Microsoft Visual C++ or Turbo C (these are program developing software)
Or else you can try this demo file and use it to find GCD and LCM ...
Click HERE to download this file.
~NOTE~ : While executing if you get any warning then just ignore it and continue with your program...
Click HERE to download this file.
~NOTE~ : While executing if you get any warning then just ignore it and continue with your program...
IF FACE ANY PROBLEM DON'T FORGET TO COMMENT ...!!
No comments:
Post a Comment