Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <conio.h>
- using namespace std;
- bool test(int a) // функция проверки числа на правильность
- {
- int k = 0;
- while (a/10 > 0) // пока число не станет меньше 10
- {
- if ((((a % 10) == 0) && ((a % 10 / 10) == 0)) || (((a % 10) == 1) && ((a % 10 / 10) == 1)))
- k++;
- a /= 10;
- }
- if (k >=1) return false;
- else return true;
- }
- void main()
- {
- int a;
- cin >> a;
- if (test(a) == true)
- cout << a << endl;
- else cout << "sykazaebaloybeitemeniapojalysta" << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement