Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int gcd(int a, int b)
- {
- if (a == 0)
- return b;
- return gcd(b % a, a);
- }
- int lcm(int a, int b)
- {
- return (a / gcd(a, b)) * b;
- }
- int main()
- {
- int a, b;
- printf("Enter the two number: ");
- scanf("%d%d", &a, &b);
- printf("LCM = %d ", lcm(a, b));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement