Sunday, 4 November 2012

transpose of a matrix c program

For beginners
{I am going write the c program but before you need a c compiler(software).there are a lot of compilers(software) for windows 7  like Code::Blocks,dev c++ Download dev c++ its free and install it in your computer.open  dev c++ go to file-->new-->source file.}  


#include<stdio.h>
#include<conio.h>
main()
{
      int m[10][10],t[10][10],k,n,d,c;
      printf("enter the metrix");
      scanf("%d%d",&k,&n);
      printf("enter the number");
      for(c=0;c<k;c++)
      {
                      for(d=0;d<n;d++)
                      { 
                                      scanf("%d",&m[c][d]);
                                      }
                                      }
                                      for(c=0;c<k;c++)
      {
                      for(d=0;d<n;d++)
                      { 
                                      t[d][c]=m[c][d];
                                      }
                                      }
                                      printf("transpose of entered matrix:-\n");
                                      for(c=0;c<n;c++)
                                      {
                                                      for(d=0;d<k;d++)
                                                      {
                                                                      printf("%d\t",t[c][d]);
                                                                      }
                                                                      printf("\n");
                                                                      }
                                                                      getch();
                                                                      }


For beginners
{After typing this program go to execute-->compile & run-->a window will pop-up-->give file name:(anything u like)-->save as type: c source files-->click save.}

IS IT HELPFIL? comment.


No comments:

Post a Comment