Advertisement
allia

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

Sep 22nd, 2020
941
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement