answersLogoWhite

0

#include<stdio.h>

main()

{

printf("Enter Order Of The Matrix\n");

int l,m;

int i,j,k,t,x;

scanf("%d%d",&l,&m);

int a[l][m],temp[l*m];

printf("Enter The Elements Row Wise...\n");

for(i=0;i<l;i++)

{

for(j=0;j<m;j++)

{

scanf("%d",&a[i][j]);

}

}

printf("Matrix A \n ");

for(i=0;i<l;i++)

{

printf("\n");

for(j=0;j<m;j++)

{

printf("%d\t",a[i][j]);

}

}

/*----------------------------------------------------------------------*/

x=0;

for(i=0;i<l;i++)

{

for(j=0;j<m;j++)

{

temp[x]=a[i][j];

x++;

}

}

for(i=0;i<l*m;i++)

{

for(j=0;j<(l*m)-1;j++)

{

if(temp[j]>temp[j+1])

{

t=temp[j];

temp[j]=temp[j+1];

temp[j+1]=t;

}

}

}

x=0;

for(i=0;i<l;i++)

{

for(j=0;j<m;j++)

{

a[i][j]=temp[x];

x++;

}

}

printf("\nMatrix A After Sort \n ");

for(i=0;i<l;i++)

{

printf("\n");

for(j=0;j<m;j++)

{

printf("%d\t",a[i][j]);

}

}

}

User Avatar

Wiki User

11y 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.


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

i cant write


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 program to multiply 33 matrix.?

write a program to multily 3*3 matrix.


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


2x2 matrix multiplication program in 8085 processor?

how to write a program for matrix multiplication in microprocesspr


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 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.


A c program to square matrix?

A C program to square matrix is a math problem. In the math problem you write down all the outer boundary values of matrix in a circle, then write down the inner value.


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.


Write a program to print the sum of a sparse matrix?

This is a directive, not a question.


Write a c program for matrix addition using function?

#include&lt;