Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Write a program to read two 5 X 5 matrices from the user and store the Addition of two matrices in the resultant matrix. i.e. C=A + B , where A,B,C each one is 5 X 5 Matrix. : GTU Nov-Dec 2010

#include
#include

main()
{
    int A[5][5],B[5][5],C[5][5],i,j;
    clrscr();

    printf("\n\n Please Enter First Matrix's Element : \n");
    for(i=0;i    {
        for(j=0;j        {
            printf("\nA[%d][%d] = ",i,j);
            scanf("%d",&A[i][j]);
        }
    }

    printf("\n\n Please Enter Second Matrix's Element : \n");
    for(i=0;i    {
        for(j=0;j        {
            printf("\nB[%d][%d] = ",i,j);
            scanf("%d",&B[i][j]);
        }
    }
    for(i=0;i    {
        for(j=0;j        {
            C[i][j] = A[i][j] + B[i][j];
        }
    }

    printf("\n\n Sum of Two Matrix : \n");
    for(i=0;i    {
        for(j=0;j        {
            printf("%d ",C[i][j]);
        }
        printf("\n");
    }

    getch();
}


This post first appeared on Ask For Program, please read the originial post: here

Share the post

Write a program to read two 5 X 5 matrices from the user and store the Addition of two matrices in the resultant matrix. i.e. C=A + B , where A,B,C each one is 5 X 5 Matrix. : GTU Nov-Dec 2010

×

Subscribe to Ask For Program

Get updates delivered right to your inbox!

Thank you for your subscription

×