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,LCM,GCD;
- scanf("%d%d",&num1,&num2);
- n1 = num1;
- n2 = num2;
- while(n2!=0)
- {
- rem = n1%n2;
- n1 = n2;
- n2 = rem;
- }
- GCD = n1;
- LCM = num1*num2;
- printf("GCD = %d\n",GCD);
- printf("LCM = %d\n",LCM);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement