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: R. Chang
Date Written: ?
Modified by: Sue Evans
Modification date: 9/24/03
Section: 101
EMail: bogar@cs.umbc.edu
Description: Illustrate two-dimensional arrays
by storing times tables for 0 through
10 in an array and then printing them
out.
*/
#include
#define SIZE 11
int main ( )
{
int i, j, table[SIZE][SIZE];
/* Fill table with the products of
the indices */
for (i = 0; i < SIZE; i++)
{
for (j = 0; j < SIZE; j++)
{
table[i][j] = i * j;
}
}
/* Print the table */
for (i = 0; i < SIZE; i++)
{
for (j = 0; j < SIZE; j++)
{
printf("%4d", table[i][j]);
}
printf ("\n");
}
return 0;
}