Skufler

3 Задача

Jan 27th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int gcd(int a, int b) {
  5. if (b == 0)
  6. return a;
  7.  
  8. return gcd(b, a % b);
  9. }
  10.  
  11. int main() {
  12. int counter = 1, a, b, temp, k = 0, kek = 0,sas;
  13. cin >> a;
  14. k = a - 1;
  15. while (k != 0) {
  16. if (gcd(k, a) == 1) {
  17. cout << k << endl;
  18. }
  19. k--;
  20. }
  21. system("pause");
  22. return 0;
  23. }
Add Comment
Please, Sign In to add comment