answersLogoWhite

0

int matrix[][]; // the matrix to find the max in

int max = matrix[0][0];

int r,c;

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

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

if(matrix[r][c] > max) {

max = matrix[r][c];

}

}

}

// max is now the maximum number in matrix

User Avatar

Wiki User

16y ago

What else can I help you with?

Continue Learning about Math & Arithmetic

How do you find the maiximum number in upper and lower triangle of a matrix in java?

You initially assume that the first number you want to compare is the maximum. Call this "maximum", for example. Then you iterate through all the other numbers you want to compare, and if you find a number that is larger than "maximum", copy this number to "maximum". To iterate through all the elements of a matrix, you have to use two "for" loops with indices, which are traditionally called "i" and "j". To restrict to an upper triangle for example, you need to calculate the corresponding range for the indices.


What is each number that you find in a matrix?

Each number in a matrix is called an element.


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.


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.


Write a c program to find eigenvalue of a matrix?

Yes, do write. That's what you always have to do when you have got a homework-program.

Related Questions

What is the Matrix Pill?

The Matrix Pill is a program to find the person still "jacked in" to the Matrix world


How do you find the maiximum number in upper and lower triangle of a matrix in java?

You initially assume that the first number you want to compare is the maximum. Call this "maximum", for example. Then you iterate through all the other numbers you want to compare, and if you find a number that is larger than "maximum", copy this number to "maximum". To iterate through all the elements of a matrix, you have to use two "for" loops with indices, which are traditionally called "i" and "j". To restrict to an upper triangle for example, you need to calculate the corresponding range for the indices.


What is each number that you find in a matrix?

Each number in a matrix is called an element.


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.


Write a C program to find sum of 3 matrices?

matrix


How do you write a java program to find the ad joint of a matrix?

bgfygfrhjyuyhh


Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix?

Sp[[Q/Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix|Answer]]ell chec[[Q/Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix&amp;action=edit&amp;section=new|Answer it!]]k your answe[[Q/Discuss:Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix|Disc]][[help/answering questions|guidelin]]Spell check your answeresussionr[[help/signing in|full benefits]] Save C[[Q/Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix|Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 ]][[Q/Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix&amp;action=edit&amp;section=new|Answering 'Write a 8085 microprocessor program to find A inverse and A transpose if A is a 3x3 matrix?']]matrix?ancel[[Q/How many animals are in West Texas|How many animals are in West Texas?]][[Q/How do you increase the number of four wheelers vehicles for servicing in a Service workshop|How do you increase the number of four wheelers vehicles for servicing in a]][[Q/How do you increase the number of four wheelers vehicles for servicing in a Service workshop|How do you increase the number of four wheelers vehicles for servicing in a Service workshop?]] Service workshop?[[Q/How do you increase the number of four wheelers vehicles for servicing in a Service workshop|How do you increase the number of four wheelers vehicles for servicing in a Service workshop?]]More Q&amp;A


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.


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.


Write a c program to find eigenvalue of a matrix?

Yes, do write. That's what you always have to do when you have got a homework-program.


How do you write c programs to read and print out matrix and find sum and max number?

To write a C program that reads a matrix, prints it, and calculates both the sum and the maximum number, you can start by declaring a 2D array for the matrix. Use nested loops to input the matrix elements from the user and to print them. During the input process, maintain a variable to track the sum of all elements, as well as another variable to find the maximum value. Finally, output the sum and the maximum value after the matrix has been fully processed. Here's a simple structure: #include &lt;stdio.h&gt; int main() { int rows, cols; printf(&quot;Enter number of rows and columns: &quot;); scanf(&quot;%d %d&quot;, &amp;rows, &amp;cols); int matrix[rows][cols], sum = 0, max = -2147483648; // Initialize max to the smallest int printf(&quot;Enter the matrix elements:\n&quot;); for (int i = 0; i &lt; rows; i++) for (int j = 0; j &lt; cols; j++) { scanf(&quot;%d&quot;, &amp;matrix[i][j]); sum += matrix[i][j]; if (matrix[i][j] &gt; max) max = matrix[i][j]; } printf(&quot;Matrix:\n&quot;); for (int i = 0; i &lt; rows; i++) { for (int j = 0; j &lt; cols; j++) printf(&quot;%d &quot;, matrix[i][j]); printf(&quot;\n&quot;); } printf(&quot;Sum: %d\nMax: %d\n&quot;, sum, max); return 0; }


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.