fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int arr[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  5. int cumm = -1, m; /* Parity would make cumm = 0 */
  6. for(m = 1; m <= 12; ++m) {
  7. const int parity = (m < 3);
  8. printf("%d\n", (cumm + parity)% 7);
  9. cumm += arr[m - 1];
  10. }
  11. return 0;
  12. }
  13.  
Success #stdin #stdout 0s 2248KB
stdin
Standard input is empty
stdout
0
3
2
5
0
3
5
1
4
6
2
4