Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #input
- a=int(input ("a="));
- b=int(input ("b="));
- #main
- c=a;
- d=b;
- while c!=d: #輾轉相除法
- if c<d:
- d=d-c;
- if c>d:
- c=c-d;
- lcm=a*b/c;
- print ('hcf= %d;lcm= %d' % (c,lcm));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement