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.
Loading
VulpesPosted Jan 1, 2012, 10:38 AM
I'd like to see you have a go at the second question yourself and help you if you get stuck. You'll get no benefit out of it otherwise. However, no-one can do it without knowing how S is calculated!
BTW, are you sure that these questions are to be programmed in C# and not some other language such as C/C++?
The reason I asked is that the question refers to a 2D array as a[0][0]. That is the syntax for a jagged 2D array in C#, not a rectangular 2D array (or matrix).