SHARE
TWEET

Untitled

a guest Oct 14th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #input
  2. a=int(input ("a="));
  3. b=int(input ("b="));
  4. #main
  5. c=a;
  6. d=b;
  7. while c!=d: #輾轉相除法
  8.   if c<d:
  9.     d=d-c;
  10.   if c>d:
  11.     c=c-d;
  12.  
  13. lcm=a*b/c;
  14. print ('hcf= %d;lcm= %d' % (c,lcm));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top