c - How to print from 1 to 9 with three numbers in a line using loops -


i coding tic tac toe game in c. stuck @ making board this:

1   2   3 4   5   6 7   8   9 

i want use loops dont have use printf function many \n's , \t's...

here's attempt:

for (i=0;i<=9;i++) {     printf("\n\n\n\t\t\t");     (j=i;j<=i+2;j++)     {         printf("%c\t",boarddots[j]);     }     if (i==3)     break; } 

something this, adapt actual needs:

for(int = 1; <= 9; ++i) {     printf("%d", i);  // print numbers 1 one     if (0 == % 3)         printf("\n"); // start new line if current number divisible 3 } 

p.s. sorry possible typos


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

How do you convert a timestamp into a datetime in python with the correct timezone? -