Write A Program To Perform The Addition Of 3x3 Matrices Using An Array

M3-R4 O-Level Jan-20 Subjective Type

M3-R4 : PROGRAMMING & PROBLEM SOLVING
THROUGH ‘C’ LANGUAGE

PART-2



/*Write a program to perform the addition of 3x3 matrices using an array*/


/* M3-R4 Q-6(B)*/


#include<stdio.h>
#include<conio.h>
void main()
 {
  int mat1[3][3],mat2[3][3],mat3[3][3]; /*Declare 3 Matrices of 3X3*/
  int i,j;
  clrscr();
  printf("Enter the elements in matrix 1\n");
  for(i=0;i<3;i++)
   for(j=0;j<3;j++)
    scanf("%d",&mat1[i][j]); 
  printf("Enter the elements in matrix 2\n");
  for(i=0;i<3;i++)
   for(j=0;j<3;j++)
    scanf("%d",&mat2[i][j]);
 /*Perform addition of matrix 1 and matrix 2 */
  for(i=0;i<3;i++)
   for(j=0;j<3;j++)
    mat3[i][j]=mat1[i][j]+mat2[i][j];
  printf("Result after addition of matrix 1 and matrix 2\n");
  for(i=0;i<3;i++)
   {
    for(j=0;j<3;j++)
    printf("%d ",mat3[i][j]);
    printf("\n");
   }
  getch();
 }

To read about click the following link

Write A Program in C To Swap Two Numbers Without Using Third Variable

Popular posts from this blog

IGNOU Solved Assignment 2023-24 | BCS-012 Basic Mathematics BCA(I)012/Assignment/2023-24

MCS-051 : ADVANCED INTERNET TECHNOLOGIES | 1. (a) Write a web application using JSP and JDBC that takes a bank account number as input and displays the account balance.

MCS054 TEE June 2021 Q1(b) | Bisection Method