Create the multiplication tables for 0 through the 10 times table.
The Method
Have a two-dimensional array called table
Fill the table with the products
Print the multiplication table
The Program
/* File: times.c
Author: Sue Bogar
Date Written: 2/24/98
Description: Illustrate two-dimensional arrays
by storing times tables for 0 through
10 in an array and then printing them
out.
*/
#include
main ( )
{
int i, j, table[11][11];
/* Fill table with the products of
the indices */
for (i = 0; i < 11; i++)
{
for (j = 0; j < 11; j++)
{
table[i][j] = i * j;
}
}
/* Print the table */
for (i = 0; i < 11; i++)
{
for (j = 0; j < 11; j++)
{
printf("%4d", table[i][j]);
}
printf ("\n");
}
}