Monday, July 2, 2018

C program to create transpose of a matrix

    /*

     * C program to accept a matrix of order MxN and find its transpose

     */

    #include <stdio.h>



    void main()

    {

        static int array[10][10];

        int i, j, m, n;



        printf("Enter the order of the matrix \n");

        scanf("%d %d", &m, &n);

        printf("Enter the coefiicients of the matrix\n");

        for (i = 0; i < m; ++i)

        {

            for (j = 0; j < n; ++j)

            {

                scanf("%d", &array[i][j]);

            }

        }

        printf("The given matrix is \n");

        for (i = 0; i < m; ++i)

        {

            for (j = 0; j < n; ++j)

            {

                printf(" %d", array[i][j]);

            }

            printf("\n");

        }

        printf("Transpose of matrix is \n");

        for (j = 0; j < n; ++j)

        {

            for (i = 0; i < m; ++i)

            {

                printf(" %d", array[i][j]);

            }

            printf("\n");

        }

    }


No comments:

Post a Comment

Henry's law constant for CO 2 ​ in water is 1.67×10 ∘ Pa at 298 K . Calculate the quantity of CO 2 ​ in 500 mL , of soda water when packed under 2.5 atm CO 2 ​ pressure at 298 K .

  Explanation To calculate the amount of CO 2 ​ dissolved, we use Henry's Law: P = k H ​ × x _ C O 2 ​ where:\ P = partial pressure of...