Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int a,b,c;
- void input() {
- cin >> a >> b;
- }
- int UCLN(int a, int b) {
- while ( a != b) {
- if (a > b)
- a = a - b;
- else
- b = b - a;
- }
- return a;
- }
- int BCNN(int a, int b) {
- c = a * b / UCLN(a,b);
- return c;
- }
- int main() {
- input();
- int t = UCLN(a, b);
- cout << t;
- int h = BCNN(a,b);
- cout << " " << h;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement