Looks like you just need a leading \t in that first line.
Code:printf("\t");
// start loops here.
Printable View
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.
Hint: Use an else statement. :biggrin:
Thanks CommonTater and iMalc, both of your suggestions worked.