Find LCM of Two Numbers
In this program we learn how to calculate LCM of two numbers by provided user using C.C program to calculate LCM of two numbers
// FIND LCM OF TWO NUMBERS
#include<stdio.h>
#include<conio.h>
void main()
{
int a, b, r, p;
float l;
clrscr();
printf("\n Enter two number : ");
scanf("%d%d",&a,&b);
p = a * b;
do
{
r = a % b;
a = b;
b = r;
}while(r != 0);
l = (float) p / a;
printf("\n The L.C.D = %f",l);
getch();
}
OUTPUT:
Enter two numbers : 27 9
The L.C.M = 27.oooooo
The L.C.M = 27.oooooo
No comments:
Post a Comment