Find Subtraction Of Two Matrix | C-Program

Subtraction of two matrix :  

 Code:

#include<stdio.h>

void main()

{
    int n;

    printf("Enter the size of the matrix:\n");

    scanf("%d",&n);

    int a[n][n],b[n][n],c[n][n],i,j;

    printf("Enter elements of 1st matrix:\n");

    for(i=0;i<=n-1;i++)

    {
        for(j=0;j<=n-1;j++)

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

    printf("Enter the elements of 2nd matrix:\n");

    for(i=0;i<=n-1;i++)

    {
        for(j=0;j<=n-1;j++)

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

    printf("The subtraction is:\n");

    for(i=0;i<=n-1;i++)

        {
            for(j=0;j<=n-1;j++)

                printf("%d\t",c[i][j]=a[i][j]-b[i][j]);

            printf("\n");
        }

    getch();
}

Output:

 Give your feedback comment below!

Comments

Popular posts from this blog

TOP 10 PROGRAMMING LANGAUAGES COMMING 2021 | ARTICLE

Write a C-program to swap two number:

Print Fibonacci Series using Recursion | C program :