Advertisement
sazid_iiuc

uva408

Jun 2nd, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int number, modulas, remainder;
  7.  
  8.     while (true)
  9.     {
  10.         cin >> number >> modulas;
  11.  
  12.         int values[modulas], i = 0;
  13.  
  14.         remainder = number % modulas;
  15.  
  16.         while (remainder != 0)
  17.         {
  18.             values[i] = remainder;
  19.  
  20.             remainder = (number + remainder) % modulas;
  21.  
  22.             if (remainder == 0)
  23.             {
  24.                 cout << "Bad Choice" << endl;
  25.                 cout<<endl;
  26.                 break;
  27.             }
  28.             else
  29.             {
  30.                 i++;
  31.  
  32.                 if (i == modulas - 2)
  33.                 {
  34.                     cout << "Good Choice" << endl;
  35.                     cout<<endl;
  36.                     break;
  37.                 }
  38.             }
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement