Saturday 18 February 2012

Transpose of 2x2 matrix program in C


/*Transpose of  2x2 matrix using C language this program written and compile with C compiler*/

#include<stdio.h>

void main()
{
    int a[2][2],i,j;     //initialize variable and array

    for(i=0;i<=1;i++)        //loop to store value  in array
      {
         
           for(j=0;j<=1;j++)
             {  
                printf("enter the value of a matrix=");
                scanf("%d",&a[i][j]);
             }
      }
    for(i=0;i<=1;i++)          //loop to print matrix value
       {
         for(j=0;j<=1;j++)
        {
           printf("\t%d",a[i][j]);
        }
      printf(" \t \n  ");
  }
}//End of main


No comments:

Post a Comment

Compiler for C,C++ and Python {paste your programme to see the output}