Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <conio.h>
  4. using namespace std;
  5.  
  6. bool test(int a) // функция проверки числа на правильность
  7. {
  8. int k = 0;
  9. while (a/10 > 0) // пока число не станет меньше 10
  10. {
  11. if ((((a % 10) == 0) && ((a % 10 / 10) == 0)) || (((a % 10) == 1) && ((a % 10 / 10) == 1)))
  12. k++;
  13. a /= 10;
  14. }
  15. if (k >=1) return false;
  16. else return true;
  17. }
  18. void main()
  19. {
  20. int a;
  21. cin >> a;
  22. if (test(a) == true)
  23. cout << a << endl;
  24. else cout << "sykazaebaloybeitemeniapojalysta" << endl;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement