Created
May 5, 2016 10:54
-
-
Save rgrig/ac3c99bfc45db6a7855650d481c8fb80 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include <stdio.h> | |
int main() { | |
const int n = 200; | |
int data[n]; | |
data[0]=0; data[1]=2; | |
int i, j; | |
i = j = 0; | |
int state = 0; | |
while (j < n) { | |
printf("%d\n",data[j]); | |
if (state == 0) { | |
if (data[j] == 0) { | |
data[j] = 1; | |
state = 1; | |
} else { | |
data[j] = 0; | |
} | |
} | |
if (data[++j] == 2) { | |
if (state == 0) {data[j++] = 1; data[j] = 2;} | |
j = 0; | |
state = 0; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment