Advertisement
Istanvir389

GCD LCM

Oct 9th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5.  
  6.  
  7. int a,b,d,c;
  8. scanf("%d %d",&a,&b);
  9. d=a*b;
  10. while(a!=0)
  11. {
  12. c=a;
  13. a=b%a;
  14. b=c;
  15. }
  16. printf("%d",b);
  17. printf("\n%d",d/b);
  18. return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement