allia

быстрый не бинарный евклид

Sep 22nd, 2020
751
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cmath>
  3. #include <string>
  4. #include <algorithm>
  5. using namespace std;
  6.  
  7. void evklid ( int a, int b)
  8. {
  9.   int l=0;
  10.   while (a!=0 && b!=0)
  11.   {
  12.      if (a>b)
  13.      a%=b;
  14.      else b%=a;
  15.   }
  16.   l=a+b;
  17.   cout << l;
  18. }
  19.  
  20. int main ()
  21. {
  22.   int a=0, b=0;
  23.   cin >> a >> b;
  24.   evklid (a, b);
  25. }
RAW Paste Data