printf ( "num: %2d", i );
or printf ( "num: %*d", 2, i );
where 2 is the max number of spaced to add
Last edited on
Thankyou :) I love this website
Also can you do the same thing with strings too?
ok finished
printf("%3d : %6s \n",i+1,color[i]);
you can also use minus symbol to make things left justified. %-3d %-30s
you can also set number of decimals for doubles/floats . %0.3d