Advertisement
labyyysosaaat

Untitled

Sep 8th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int NOD(int a, int b);
  4. int main() {
  5. int a, b;
  6. int i;
  7. cin >> a >> b;
  8. if (a < b)
  9. i = a;
  10. else i = b;
  11. while (a%i != 0 || b % i != 0) {
  12. i = i - 1;
  13.  
  14. }
  15. cout <<"NOD="<< i << endl;
  16. int j = (a*b) / i;
  17. cout << "NOK=" << j << endl;
  18.  
  19.  
  20. system("pause");
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement