Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int x, y, A, B, cash, coun;
- int main()
- {
- cin >> A;
- cin >> B;
- coun = 0;
- while ((A != 0 && B != 0)) {
- if (A!=B) {
- if (A != 0 && B != 0)
- {
- while (A >= B)
- {
- A = A - B;
- coun++;
- if (A == 0 || B == 0) { break; }
- }
- }
- if (A != 0 && B != 0)
- {
- while (B >= A)
- {
- B = B - A;
- coun++;
- if (A == 0 || B == 0) { break; }
- }
- }
- }
- else
- {
- coun++;
- A = 0;
- B = 0;
- }
- }
- cout << coun;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement