Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Written in C++, used in code blocks. I am stuck on writing the code for the sum of diagonal elements. This is what i have

Written in C++, used in code blocks. I am stuck on writing the code for the sum of diagonal elements. This is what i have so far.

#include

#define SIZE 4

int main() { int A[SIZE][SIZE]; int row, col, sum = 0; int d_sum = 0;

// Wasn't sure how to display the matrix, but I got it so you type in the table exactly how you see it and it will output everything correctly. //This function below prints your table printf("Enter elements in matrix of size %dx%d: ", SIZE, SIZE); for(row=0; row

printf("Sum of elements of Row %d = %d ", row+1, sum); } // This function prints all the column sums for(row=0; row

printf("Sum of elements of Column %d = %d ", row+1, sum); } // This function prints the diagonal sum. for(row=0; row

return 0; }

image text in transcribed

-With given values of "a", "b, c", "d, e", and "f", the answer for x is Answer', and y is "Answer" 3. For the given table below, 1) use array to calculate row sum, column sum and sum of diagonal elements. 2) And create a new Table Array with the result then display it! 4 8 12 16 6 10 9 13 15 New Table Array 4 8 12 16 Column 4 Sum Row 1 Sum Row 1 Sum Row 1 Sum Row 1 Sum Diagonal 6 10 9 13 Column 1 Sum Column 2 Sum 15 Column 3 S um Sum

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

6. What questions would you suggest should be included?

Answered: 1 week ago