heian

Untitled

Oct 23rd, 2019
97
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. Sa se afiseze cel mai mare divizor comun al lor.
  8. */
  9.  
  10. int main()
  11. {
  12. int a,b,r;
  13. cin>>a>>b;
  14. r = a%b;
  15. while(r)
  16. {
  17. a = b;
  18. b = r;
  19. r = a%b;
  20. }
  21. ///acum, cmmdc se va afla in b
  22. cout<<b<<"\n";
  23. return 0;
  24. }
RAW Paste Data