Advertisement
DMG

Cokolada (z2)

DMG
Apr 16th, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. main()
  4. {
  5.       int m, n, s = 0;
  6.      
  7.       cin >> m >> n;
  8.      
  9.       while (m>0 && n>0)
  10.       {
  11.             while(m>=n && n!=0 && m!=0)
  12.             {
  13.                       m = m - n;
  14.                       s++;
  15.             }
  16.            
  17.             while(n>=m && n!=0 && m!=0)
  18.             {
  19.                       n = n - m;
  20.                       s++;
  21.             }
  22.       }
  23.      
  24.       cout << s-1 << endl;
  25.      
  26.       system ("PAUSE");
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement