SHARE
TWEET

Untitled

heian Oct 23rd, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. /**
  6.     Se citesc doua numere naturale a,b.
  7.     a)Sa se afiseze cel mai mare divizor comun al lor.
  8.     b)Sa se afiseze cel mai mic multiplu comun al lor.
  9. */
  10.  
  11. int main()
  12. {
  13.     int a,b,r, A, B;
  14.     cin>>a>>b;
  15.     A = a;
  16.     B = b;
  17.     r = a%b;
  18.     while(r)
  19.     {
  20.         a = b;
  21.         b = r;
  22.         r = a%b;
  23.     }
  24.     ///acum, cmmdc se va afla in b
  25.     cout<<b<<"\n";
  26.     cout<<(A*B)/b<<"\n";
  27.     return 0;
  28. }
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
 
Top