#include <stdio.h>

int main(){
int a;
int b = 4 ;
int c;
b*=b;

for (a =1; a<b; ++a)
{
if(a%3 == 0 && a>3)
{
for (c=0; c< a-8 ;c++)
{
printf("%d\n", c);
}
}
}
system("pause");
return (1);
}

The output is this

0
0
1
2
3
0
1
2
3
4
5
6

regards!