hello everyone!!
first let me tell you that iam newbie.. ive just started this a few months ago.. ( so if u could please put appropraite detailed comments.. u will be helping a newbie understand it better... thankyou.
iam trying to produce a transpose of a matrix.
(the transpose of a matrix is obtained by exchanging the elements of each row witht the elements of the corresponding cloumn).
The program should ask the user to enter the number of rows and columns of a matrix. it then asks to enter matrix row by row. Once all values are read from the keyboard, it prints the orignal matrix entered by the user and its transpose in an appropriate format. finally it asks the user if the transpose of another matrix is required . the program keeps repeating this process until the user enters n or N ans the terminates.
p.s .. ihave to make use of functions and validation..e.g it should not accept the matrix 1x1.. cause it is invalid.
so far ive done. this.. but i got lots of buggs in it.. if any one could please help me here ... i would be greatful... thank you.....
/*exam_prac.c*/
/*Multiplication of matrices*/
date:3-march-2003*/
#include<stdio.h>
int matrix1[10][10],i;
int rows,columns;
int transpose()
{
/*------------------- MATRIX --------------------------
----------
-*/
rows=rows-1;
for(i=0;i<=columns;i++)
{
printf("\nEnter valus for row %d\n",i);
columns=columns-1;
for(i=0;i<=columns;i++)
{
scanf("%d%d",& matrix1[i][columns]);
}
}
printf("\nColumns and rows");
for(i=0;i<=columns;i++)
{
for(i=0;i<=columns;i++)
{
printf("\n%d", matrix1[i][columns]);
}
}
/*------------------------
----------
----------
----------
----------
-----*/
}
int main()
{
int row,column;
printf("\n PLEASE ENTER THE NUMBER OF ROWS");
scanf("%d",&rows);
printf("PLEASE ENTER THE NUMBER OF COLUMNS");
scanf("%d",&columns);
transpose();
printf("\nThe transpose of the matrix is\n ");
for(i=0;i<=column;i++)
{
printf("\n%d%d",matrix1[0]
[i],matrix
1[1][i]);
}
return 0;
}