answersLogoWhite

0

#include<iostream>

int main()

{

int matrix[3][3];

for (size_t row=0; row<3; ++row)

{

for (size_t col=0; col<3; ++col)

{

std::cout << "Enter a value for element [" << row << "][" << col << "]: ";

std::cin >> matrix[row][col];

}

}

std::cout << std::endl;

for (size_t row=0; row<3; ++row)

{

for (size_t col=0; col<3; ++col)

{

std::cout << matrix[row][col] << '\t';

}

std::cout << std::endl;

}

std::cout << std::endl;

}

User Avatar

Wiki User

10y ago

What else can I help you with?

Related Questions

How do you write a java program to find the transpose of the matrix for the given elements?

You basically write a nested for loop (one for within another one), to copy the elements of the matrix to a new matrix.


Write a C program using dynamic memory allocation to find the sum of elements of a matrix?

Did you know that memory allocation is not needed to display the matrix? However, the C program is to find the sum of all the elements.


What is a reduced matrix?

Reduced matrix is a matrix where the elements of the matrix is reduced by eliminating the elements in the row which its aim is to make an identity matrix.


How do you write c program to perform sum of elements of matrix using pointers with functions?

i cant write


What are elements of a matrix?

They are the number in the matrix.


How do you write a C program to find the adjoint of a matrix?

To write a C program to find the adjoint of a matrix, first, you need to create a function to calculate the cofactor of each element in the matrix. Then, construct the adjoint by transposing the cofactor matrix. The program should read the matrix size and elements from user input, compute the cofactors using nested loops, and finally display the adjoint matrix by transposing the cofactor matrix. Make sure to handle memory allocation for dynamic matrices if needed.


How do you write a program that calculates the sum of the matrix elements given numbers?

ring me and ill explain - 086 22222222222222227 ring me


How do you calculate matrix on fx-991 ms?

To calculate a matrix on the Casio fx-991MS, first, press the &quot;MODE&quot; button until you select the Matrix mode. Next, choose the matrix size by selecting the appropriate dimensions (e.g., 2x2, 3x3) and input the elements of the matrix. After entering the matrix, you can perform operations like addition, multiplication, or finding the determinant by selecting the corresponding function from the matrix menu. Make sure to follow the prompts on the display to complete your calculations.


What is a sparse matrix?

A sparse matrix is a matrix in which most of the elements are zero.


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.


Write a C program to accept the elements of a 3 x 3 matrix and find its sum of the major diagonal elements The program should print the given matrix along with its sum of the major diagonal elements?

#include &lt;stdio.h&gt; #include &lt;conio.h&gt; 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 &lt; 3; j++) { for (k = 0; k &lt; 3; k++) printf(" %3d", d[j][k]); printf("\n"); } for (j = 0; j &lt; 3; j++) { sum1 = sum1 + d[j][j]; } k = 3 - 1; for (j = 0; j &lt; 3; j++) { if (k &gt;= 0) { sum2 = sum2 + d[j][k]; k--; } } printf("Sum of First diagonal= %d\n", sum1); printf("Sum of Second diagonal= %d", sum2); getch();


Write a program to multiply 33 matrix.?

write a program to multily 3*3 matrix.