Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main ()
- {
- int num1,num2,n1,n2,rem,GCD,LCM;
- printf("Enter the numbers:");
- scanf("%d%d", &num1, &num2);
- n1=num1;
- n2=num2;
- while (n2!=0)
- {
- rem=n1%n2;
- n1=n2;
- n2=rem;
- }
- GCD=n1;
- printf("GCD=%d\n", GCD);
- LCM=(num1*num2)/GCD;
- printf("LCM=%d\n", LCM);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement