answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<conio.h>

void main()

{

int a[10][10],i,j,k,m,n;

printf("enter the order");

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

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

{

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

{

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

}

}

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

{

for(i=0;i<=m-1;i++)

{

for(j=0;j<n-i-1;j++)

{

if(a[k][j]>a[k][j+1])

temp=a[k][j];

a[k][j]=a[k][j+1];

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

}

}

}

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

{

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

{

printf("sorted matrix=%d",a[i][j]);

}

}

getch();

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

int i, j;

printf("\nEnter number of rows & cols of array A: ");

scanf("d", &m, &n);

printf("\nEnter elements of array A:\n");

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

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

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

printf("\nEnter number of rows & cols of array B: ");

scanf("d", &x, &y);

printf("\nEnter elements of array B:\n");

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

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

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

printf("\n\nArray A:\n\n");

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

{

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

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

printf("\n\n");

}

printf("\n\nArray B:\n\n");

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

{

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

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

printf("\n\n");

}

multiply();

printf("\n\nArray after multiplication:\n\n");

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

{

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

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

printf("\n\n");

}

getch();

}

void multiply()

{

int i, j, k;

if(m != y n != x)

{

printf("\n\nMultiplication is not possible.");

exit();

}

else

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

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

{

c[i][j] = 0;

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

c[i][j] = c[i][j] + a[i][k] * b[k][j];

}

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Program for row wise sort for a square matrix in C?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the difference between Top down design and step wise refinement?

The top-down design starts from the start of the program and tracks down all steps but the step wise refinement is backwards.


The compiler is responsible for what?

its just convert the source language of a program to target language at once.....whereas interpreter do it line wise....


What is output stream?

Messages and other output data that an operating system or a processing program displays on output devices. It is a means of writing data in a byte-wise manner to a target.


Why is quick sort and merge sort called stable algorithms?

Quick sort is not stable, but stable versions do exist. This comes at a cost in performance, however. A stable sort maintains the order of equal elements. That is, equal elements remain in the same order they were input. An unstable sort may change the order. In some cases, the order of equal elements is of no consequence, but when two elements with different values have the same sort key, then order can be important.


What is Stepwise refinement techniques in data structure?

Step-wise refinement is a technique for software development using a top-down, structured approach to solving a problem. It allows the developer to use a controlled method of developing an algorithm that will eventually solve a given problem.Basically, step-wise refinement involves the use of a generalized approach to a problem, perhaps written in pseudo-code. The next step would be to fill in one of the holes in the code. The pseudo-code describes a general, non-specific way to solve the problem deferring the actual decisions until last minute. That way the developer can assign place-holders in the logic until they are actually needed.Then, each step involves the use of refining (adding the logic) a step in the development of the algorithm to make it more specific, doing so one step at at time.When everything has been refined you have a complete program; however, it takes multiple steps (step-wise refining) to get to that point where a complete, syntactically correct program emerges.

Related questions

What did wise men wear?

The Wise Men wore cloak sort of thingz


What sort of man do you think melchior is?

Wise


What are the 4 ways to solve linear equations?

Step-wise substitution of variablesStep-wise elimination of variablesGraphical[Generalised] Inversion of coefficient matrix


How many square miles are in wise county Virginia?

Wise County, Virginia has a total area of 405 square miles.


What is the largest state land wise?

With 663,267.26 square miles, the state of Alaska is the largest state in the USA land-wise. The second largest is Texas, with 268,580.82 square miles.


Where do i find wordly wise answers?

It depends on the question. There are plenty of wise answers here on our site if you ask the right sort of question. Something like "Who would win: Superman or Batman?" isn't going to get a wise reply, for example.The main site Answers.com, is also another good place for information. There are many good sites where you could get wise answers.Why don't you ask your question and see what sort of answer you get?


Is wet food good?

if it comes in jelly or some sort of gravy then yes but other wise no


What sort of accommodation did ancient rome have?

ancient rome had small villas were you live but other wise you lived with your master


What rank area wise is Kentucky?

37th in total area with 40,409.02 square miles.


How many square 5 feet are in 3 feet?

This may have different answers but cube wise (3x3x3 leading to 9, 18, 27) you are looking at 27 cubes in total where as 5 feet cube wise is 125 cubes in total. Answer = There is no 5 square feet in 3 square feet.


How do you use java technology?

it depends on what you mean... if you want to program it id then suggest you started with a program called robocode it teaches to learn java. other wise if your trying to access a program then do a system search.


How much does a square foot of land cost?

That depends on the location. A square foot of land in Nigeria will be different cost-wise than a square foot of land in Boise, Idaho.