x2311

Untitled

Jan 12th, 2022
1,060
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int fan(int n1, int n2);
  6.  
  7. int main() {
  8.     int numb1, numb2, rez;
  9.  
  10.     cout << "numb1: ";
  11.     cin >> numb1;
  12.  
  13.     cout << "numb2: ";
  14.     cin >> numb2;
  15.  
  16.  
  17.     rez = fan(numb1, numb2);
  18.     cout << "rez: " << rez;
  19.  
  20.     return 0;
  21. }
  22.  
  23. int fan(int min, int max) {
  24.     int mod;
  25.  
  26.     mod = max % min;
  27.  
  28.     if (mod == 0) {
  29.         return min;
  30.  
  31.     }
  32.     min = mod;
  33.     max = min;
  34.  
  35.     fan(min, max);
  36. }
Advertisement
Add Comment
Please, Sign In to add comment