Looks like you just need a leading \t in that first line.
Code:printf("\t"); // start loops here.
Looks like you just need a leading \t in that first line.
Code:printf("\t"); // start loops here.
Hello,
I am creating a program which has the output of a 9 X 9 multiplication table.
From that I achieve this output:Code:#include <stdio.h> int main() { int k,q; printf("\t\t\t Multiplication Table\n\n"); for ( k = 0; k < 10; k++ ) if ( k != 0 ) printf("%3d",k); printf("\n"); for ( k = 1; k < 10; k++ ) { printf("%3d",k); for ( q = 1; q < 10; q++ ) printf("%3d", k*q); printf("\n"); } }
Deleted Image
The numbers at the very top of the table are misaligned. Is there a way to align the two ones like a normal multiplication table? I tried many things but they all ruined the other numbers. Thanks.
Last edited by kermi3; 11-18-2011 at 08:31 PM. Reason: User privacy, via request
Hint: Use an else statement.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
Thanks CommonTater and iMalc, both of your suggestions worked.