Some Little Questions

Jan 1 2012 8:44 AM
1- Write a program that increases each element of a 2D matrix by the average of all elements of the matrix.




2- Write a program that asks for the dimension N, 1 < N = 10 and calculates the entries aij of a square matrix A as aij = i + j. The program then asks for an integer number M, 1 = M = 20 and calculates the value S as follows,



Print S out to the screen. Also, print A out to the screen as a table of numbers. Provide a check of the condition 1 < N = 10 in your program. Validate the program for N of your choice.

Hint: For the questions above, do not forget that the matrix entry a11 should be always related to the array element a[0][0] in your program.




Answers (1)