[ create a new paste ] login | about

Link: http://codepad.org/0uzeEu8B    [ raw code | output | fork ]

C, pasted on Sep 27:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
void aho(int *a)
{
    int x1, x2, x3, x4, x5, x6, x7;
    for (x1 = 0; x1 < 5; x1++)
      for (x2 = 0; x2 < 5; x2++)
        for (x3 = 0; x3 < 5; x3++)
          for (x4 = 0; x4 < 5; x4++)
            for (x5 = 0; x5 < 5; x5++)
              for (x6 = 0; x6 < 5; x6++)
                for (x7 = 0; x7 < 5; x7++)
                  a[(x1+x2+x3+x4+x5+x6+x7) % 7] += 1;
}
int main(int ac, char **av)
{
    int a[7] = {0}, i;
    aho(a);
    for (i = 0; i < 7; i++)
      printf("%d: %d\n", i, a[i]);
    return 0;
}


Output:
1
2
3
4
5
6
7
0: 11177
1: 11172
2: 11158
3: 11144
4: 11144
5: 11158
6: 11172


Create a new paste based on this one


Comments: