Question: #include #include using namespace std; int main() { int Matrix [4][4], r=4, c=4, i, j,k,sumc=0, sumr=0,sumd1=0,sumd2=0,sumd; for(i=0 ; i for (j=0 ; j if (k%2!=0)

 #include #include using namespace std; int main() { int Matrix [4][4],

#include #include using namespace std; int main() { int Matrix [4][4], r=4, c=4, i, j,k,sumc=0, sumr=0,sumd1=0,sumd2=0,sumd;

for(i=0 ; i

for (j=0 ; j

if (k%2!=0) { Matrix[i][j]=k; cout

for(i=0 ; i

cout

for(i=0 ; i

cout

for(i=0 ; i

for(i=0 ; i

sumd=sumd1+sumd2;

cout

cout

for(i=0 ; i

for(i=0 ; i

for(i=0 ; i

cout

for(i=0 ; i

cout

for(i=0 ; i

for(i=0 ; i

sumd=sumd1+sumd2;

cout

return 0; }

Problem 3 Declare a two dimensional array of the type int named Matrix of the size 4 x 4, i.e. 4 rows and 4 columns. Initialize the array such that the first two columns are initialized to the first 8 even numbers, and the last two columns are initialized to first 8 odd numbers, display the array Matrix as shown in the sample input/output. Calculate and display the sum of the elements of the first column, fourth row, and diagonals. Now multiply the first and the fourth columns of the Matrix by 2, display the array and the sum of the elements of the first column, fourth row and diagonals. Sample input / output: 8 1 9 2 10 3 11 4 12 5 13 6 14 15 um of the first column is: 12 Sum of the fourth row is: 42 Sum of the diagonals is: 60 After the multiplication 0 8 1 18 4 10 3 22 8 12 5 26 12 14 30 Sum of the first column is 24 Sum of the fourth row is: 63 Sum of the diagonals is:90

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!