answersLogoWhite

0

#include <stdio.h>

#include <conio.h>

void main() {

int d[3][3] = { 1, 2, 6, 3, 8, 5, 5, 6, 7 };

int k = 0, j = 0;

int sum1 = 0, sum2 = 0;

for (j = 0; j < 3; j++) {

for (k = 0; k < 3; k++)

printf(" %3d", d[j][k]);

printf("\n");

}

for (j = 0; j < 3; j++) {

sum1 = sum1 + d[j][j];

}

k = 3 - 1;

for (j = 0; j < 3; j++) {

if (k >= 0) {

sum2 = sum2 + d[j][k];

k--;

}

}

printf("Sum of First diagonal= %d\n", sum1);

printf("Sum of Second diagonal= %d", sum2);

getch();

User Avatar

Wiki User

13y ago

What else can I help you with?

Continue Learning about Educational Theory

C program to find sum of all elements of a matrix?

/* @Autor: MD moniruzzaman http://www.youngprogrammer.com */ #include&lt;stdio.h&gt; #define maxn 5 int matrix[maxn][maxn] = { {1,2,3,3,4},{2,3,4,1,2},{ 4,5,6,7,8},{3,4,5,6,9},{4,3,2,1,0}}; /* Given matrix is: 1 2 3 3 4 2 3 4 1 2 4 5 6 7 9 3 4 5 6 9 4 3 2 1 0 */ int main() { int sum = 0, i, j; for(i = 0; i&lt;5; i++) { for(j = 0; j&lt;5; j++) { sum+= matrix[i][j]; } } printf("%d\n",sum); return 0; }


What does post matrix study mean?

Post-matrix study refers to research or analysis conducted after a matrix has been created. It involves examining the results, patterns, or implications identified through the matrix and drawing conclusions or recommendations based on this study. The goal is to deepen understanding, resolve issues, or make informed decisions using the information provided by the matrix.


What is the purpose of a cause-and-effect matrix?

A cause-and-effect matrix is used to analyze the relationship between different variables in a process and determine how they influence each other. It helps in identifying the key factors that contribute to a particular outcome or problem, enabling organizations to prioritize their efforts on addressing the root causes of issues.


Which of these will help you prioritize the items on your to-do list?

Using three groups to show how important each item is


What is the difference between think and believe?

In both ''think'' and ''believe'' there is a verb of cognition (awareness, certainty). The difference lies in the nature of truth value predicated of the complement clause by the matrix verb( believe vs. think) We could couch this truth value predicated either in terms of a) epistemic modality or b) evidentiality. Either way, the verb ''think'' denotes less confidence in the truth of the complement clause than the verb ''believe''(but they both denotes lesser confidence than the verb ''know'')

Related Questions

Is the scalar matrix is always a identity matrix?

No. A scalar matrix is a diagonal matrix whose main diagonal elements are the same. Only if the diagonal elements are all 1 is it an identity matrix.


What is the determinant of a 3x3 diagonal matrix?

It is the product of the three diagonal elements.


Is a matrix multiplied by its transpose diagonalisable?

It will be a square matrix and, to that extent, it is diagonalisable. However, the diagonal elements need not be non-zero. It will be a square matrix and, to that extent, it is diagonalisable. However, the diagonal elements need not be non-zero. It will be a square matrix and, to that extent, it is diagonalisable. However, the diagonal elements need not be non-zero. It will be a square matrix and, to that extent, it is diagonalisable. However, the diagonal elements need not be non-zero.


How do you Write A program in c language for checking a diagonal matrix?

Write a program in c++ that take input in a integer matrix of size 4*4 and find out if the entered matrix is diagonal or not.


What is the determinant of a 3x3 matrix?

It is the product of the three diagonal elements.


What is scalene matrix?

A square matrix is said to be scalene Matrix if it has all principal diagonal elements equal and remaining all


What is the definition of a diagonal matrix?

Diagonal Matrix A square matrix A which is both uper-triangular and lower triangular is called a diagonal matrix. Diagonal matrix is denoted by D.


What is the definition of a matrix?

Symmetric Matrix:Given a square matrix A such that A'=A, where A' is the transpose of A, then A is a symmetric matrix.note: No need to think about diagonal elements, they can be anything.


what is the definition of The Matrix?

Symmetric Matrix:Given a square matrix A such that A'=A, where A' is the transpose of A, then A is a symmetric matrix.note: No need to think about diagonal elements, they can be anything.


What is the definition of a symmetric matrix?

Symmetric Matrix:Given a square matrix A such that A'=A, where A' is the transpose of A, then A is a symmetric matrix.note: No need to think about diagonal elements, they can be anything.


Write a c program on reverse the diagonal element of matrix?

mano ni anda yarrr


Is null matrix is diagonal matrix?

Yes.