I need to write a program that reads an integer matrix A from standard input and outputs the input matrix and the transpose. The input matrix A is limited to have at most 10 rows and 10 columns. Given a matrix A has m rows and n columns, m ≤ 10 and n ≤ 10. Note that m and n need not be equal.
Input to the program starts with a positive integer n that gives the number of columns in A. This integer is followed by (m * n) integers that specify, row by row, the elements of A. Integers are separated in the input by white space. Note that only n is explicitly specified in the input.

I've written the following but its not advanced enough please write this code for me!! Im in dire need!!

``````#include<stdio.h>
int main(void)
{
int mat[10][10],i,j,cols,rows;
printf("Enter the number of columns");
scanf("%d", cols);

scanf("%d", rows);

for(i=0;i<cols;i++)
for(j=0;j<rows;j++)
{
scanf("%d",&mat[cols][rows]);
}
for(i=0;i<cols;i++)
{
for(j=0;j<rows;j++)
{

printf("%d ",mat[cols][rows]);
}
printf("\n");
}
printf("The transpose is:\n");

for(i=0;i<cols;i++)
{
for(j=0;j<rows;j++)
{
//mat[i][j]= mat[j][i];
// printf("The transpose is:\n");
printf("%d ", mat[rows][cols]);
}
printf("\n");
}

return 0;
}
``````

please write this code for me!! Im in dire need!!

Why do you people continually ask us to do your work for you? This constant request for cheating is really getting annoying!

Find something else to do.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.