Advertisement
STANAANDREY

cmmdc

Nov 10th, 2018 (edited)
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.   int a = 0, b = 0, r = 0;
  7.   cout << "a=";
  8.   cin >> a;
  9.   cout << "b=";
  10.   cin >> b;
  11.   while (b) {
  12.     r = a % b;
  13.     a = b;
  14.     b = r;
  15.   }
  16.   cout << "cmmdc= " << a;
  17.  
  18.   return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement