Programming Practice

Let A be an m´n integer matrix and V be an integer vector of length n. U is an integer vector of length n such that it is the product of matrix A and vector V is defined as below, when m=4 and n=8:

Write a C program to:

  1. Declare A as a 100´100 two-dimensional array and U and V as one-dimensional arrays of 100 elements.

  2. Enter integer values of m and n (assume 3m, n100),

  3. Generate the elements of A and V randomly.

  4. Compute and output the elements of matrix A, vector V, and vector U.

Matrix and vector product should be written as function void matrix_vector_product(int m, int n, int A[100][100], int V[100], int U[100]). Program execution example is shown as the followings:

Enter a positive integer m (between 3 and 100): 4
Enter a positive integer n (between 3 and 100): 8


Matrix A:
40  32  59  30  54  80  37  26
 1  27  91  58  17  54  74  33
50  44  59  60  46  86   1  54
68  43  75  10  42  19  35  26

Vector V is:  58   46   47   31   48    8   84   28

Vector U is:  14563   15763   14049   15593