The Tech World..!!
C Program to find the LCM of 2 Numbers
#include<stdio.h>
int main()
{
int a, b, x, y;
printf("Enter two Numbers \n");
scanf("%d \t %d",&a,&b);
x = a;
y = b;
while( a != b ) {
if( a > b )
a = a-b;
else
b = b-a;
}
printf("LCM of 2 numbers = %d\n ",x * y / a );
return 0;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment