Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int numberLength = 2;
- bool text[numberLength];
- for (int i = 0; i < numberLength; i++) {
- text[i] = false;
- }
- bool done = false;
- int numbers = 0;
- int numbersCount = 0;
- while (true) {
- int start = 0;
- while (true) {
- if (text[start] == true) {
- text[start] = false;
- start++;
- numbersCount--;
- if (start >= numberLength) {
- done = true;
- break;
- }
- continue;
- }
- break;
- }
- if (done) {
- break;
- }
- text[start] = true;
- numbersCount++;
- numbers += numbersCount;
- for (int i = 0; i < numberLength; i++) {
- printf("%s ", text[numberLength - i - 1] == true ? "1" : "0");
- }
- printf("\n");
- }
- printf("%d", numbers);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement