C Programs

Write a C program for matrix addition?

/*  C Program for matrix addition */
#include<stdio.h>
#include<conio.h>
#define m 2
#define n 2
int main(){
    int A[m][n],B[m][n],C[m][n],i,j;
    clrscr();
    printf("Enter Elements for A matrix :\n");
    for(i=0;i<m;i++){
        for(j=0;j<n;j++){
            scanf("%d",&A[i][j]);
        }
    }
    printf("Enter Elements for B Matrix :\n");
    for(i=0;i<m;i++){
         for(j=0;j<n;j++){
            scanf("%d",&B[i][j]);
         }
    }
    /* Addition Operation starts here */
    for(i=0;i<m;i++){
     for(j=0;j<n;j++){
        C[i][j] = A[i][j] + B[i][j];
     }
    }
    /* print C Matrix here */
    printf("Addition Matrix is :\n");
    for(i=0;i<m;i++){
       for(j=0;j<n;j++){
          printf("%d ",C[i][j]);
       } 
       printf("\n");
    }
    getch();
    return 0;
}

www.000webhost.com