fork download
  1. #include <stdio.h>
  2.  
  3. int cycle(int n) {
  4. switch (n % 4)
  5. {
  6. case 0: return 0;
  7. case 1: return 1;
  8. case 2: return 2;
  9. case 3: return 1;
  10. }
  11. }
  12.  
  13. int main()
  14. {
  15. int i;
  16. for (i = 0; i < 50; i++) {
  17. printf("%d,", cycle(i));
  18. }
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0.01s 1676KB
stdin
Standard input is empty
stdout
0,1,2,1,0,1,2,1,0,1,2,1,0,1,2,1,0,1,2,1,0,1,2,1,0,1,2,1,0,1,2,1,0,1,2,1,0,1,2,1,0,1,2,1,0,1,2,1,0,1,