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",gcd);
- printf("lcm=%d",lcm);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement