Advertisement
LuongIT

bt_19_20_by_luong_uit

Nov 4th, 2015
417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #include "iostream"
  2. #include "conio.h"
  3. using namespace std;
  4. int ucln(int a, int b)
  5. {
  6. while (a != b)
  7. {
  8. if (a < b)
  9. b = b - a;
  10. else
  11. a = a - b;
  12. }
  13. return b;
  14. }
  15. void main()
  16. {
  17. int a,b;
  18. cin >> a; cin >> b;
  19. cout << "UCLN la: " << ucln(a,b) << endl;
  20. cout << "BCLN la: " << (a*b)/ucln(a,b) << endl;
  21. _getch();
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement