Write a program to multiply a two-dimensional matrix in the following way: multiply
all elements in row i by (−1)i
i. That is, multiply row 1 by −1, row 2 by +2, row 3 by
−3, and so on. Your program should be able to read matrices of size up to 10 × 10. You
should query the user for number of rows, number of columns, and then read the matrix
element values. These values should be within the range of 8-bit signed numbers (i.e.,
between −128 to +127). Internally, use words to store the number so that there will not
be overflow problems with the multiplication. Make sure to do proper error checking,
for example, asking for more than 10 rows or columns, entering an out-of-range value,
and so on.
Q7–P6 We know that
1+2+3+ ··· + N =
N × (N + 1)
2
.
Write a program that requests N as input and computes the left-hand and the right-hand
sides of the equation, verifies that they are equal, and displays the result.