I have to make a multiplication table. The program works correctly but I need to put the numbers multiplied in the array also. EX.
x 0 1 2 3 4 5 6 7 8 9 10 11 12
0
1 answers
2
3
4
5
6
7
8
9
10
11
12
I need to print out the outside numbers with the products. Any suggestions on the code?
#include <stdio.h>
#define COLUMN_SIZE 13 //define the column array size
#define ROW_SIZE 13 //define the row array size
int main (void) //main function
{
int i, j; //counters
int column[COLUMN_SIZE] = {0,1,2,3,4,5,6,7,8,9,10,11,12}; //column array
int row[ROW_SIZE] = {0,1,2,3,4,5,6,7,8,9,10,11,12}; //row array
int product[ROW_SIZE][COLUMN_SIZE] = {{},{}}; //product array
for(int i=0; i<ROW_SIZE; i++){ //for loop to cycle through row array
for(int j=0; j<COLUMN_SIZE; j++){ //for loop to cycle through column array
product[i][j] = row[i] * column[j]; //equation
printf("%d", product[i][j]); //prints product array
} //end column array for loop
printf("\n"); //new line
} //end row array for loop
return 0; //successful termination
} //end main function