Dec 12, 2009 at 5:35pm
printf ( "num: %2d", i );
or printf ( "num: %*d", 2, i );
where 2 is the max number of spaced to add
Last edited on Dec 12, 2009 at 5:36pm
Dec 12, 2009 at 5:41pm
Thankyou :) I love this website
Dec 12, 2009 at 5:44pm
Also can you do the same thing with strings too?
Dec 12, 2009 at 5:49pm
ok finished
printf("%3d : %6s \n",i+1,color[i]);
Dec 13, 2009 at 1:40am
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