Sunday 27 November 2011

C program for Find Transpose Using Array


#include<stdio.h>
#include<conio.h>
void main()
{
   int r,c,i,j,a[4][4],t[4][4];
   clrscr();
   printf("\n enter the row of matrix=");
   scanf("%d" ,&r);
    printf("\n enter the colum of matrix=");
   scanf("%d" ,&c);
   printf("\n enter data for the matrix=");
   for(i=0;i<r;i++)
    {
 for(j=0;j<c;j++)
  {
    scanf("%d",&a[i][j]);
       }
 
}
    for(i=0;i<c;i++)
{
  for(j=0;j<r;j++)
   {
 t[i][j] =a[i][j];
 printf("%d",t[i][j]);
}
printf("\n");
}
getch();
}
  

No comments:

Post a Comment