Advertisement
rony-Rony_05

problem 2

Jun 19th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.25 KB | None | 0 0
  1.  #include<stdio.h>
  2. int main()
  3. {
  4. int num1,num2,n1,n2,rem,lcm,gcd;
  5. scanf("%d%d",&num1,&num2);
  6. n1=num1;
  7. n2=num2;
  8. while(n2!=0)
  9. {
  10. rem=n1%n2;
  11. n1=n2;
  12. n2=rem;
  13. }
  14. gcd=n1;
  15. lcm=num1*num2;
  16. printf("gcd=%d",gcd);
  17. printf("lcm=%d",lcm);
  18. return 0;
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement