Book Your slot
X
ONLINE BOOKING
BOOK NOW
OFFLINE BOOKING
Call or WhatsApp 7993732682 (WhatsApp Now), 9177341827 (WhatsApp Now)
search
Menu Login home
  • Questions

  • Library

  • University Updates

  • Informatives

  • Technology Lines

  • Training & Internships

  • X
    Menu
  • Home
  • Privacy Policy
  • Legal Disclaimer
  • Terms & Conditions
  • Return Policy
  • About Us
  • Need any help?? write to us at

    support@engineershub.co

    Follow Us

    X
    LOGIN
    Login to access posts, links, updates, question papers, materials, one liners!
    Use Your Email Address/Mobile and Password to Login
    Forgot Password?
    Not a member? Sign Up
    LOGIN WITH EMAIL/MOBILE
    Forgot Password?
    Go Back
    FORGOT PASSWORD
    Go Back
    RESET PASSWORD
    Go Back
    Continue with LinkedIn
    OR
    Fill Up a Simple Form
    Already a Member? Login
    SIGN UP
    Fill all the below details correctly and click on Next
    Go Back
    Write a program to perform matrix addition? - EngineersHub
    Go Back
    Question
    Anandam Lokesh
    4 years ago
    1 Answer(s) posted Write an answer 4792
    Answer
    Read Mode
    Answer posted by Venu Gopal reddy Seelam
    4 years ago

    /* ADDITION OF TWO MATRICES*/

    #include<stdio.h>

    #include<conio.h>

    #include<process.h>

    void main( )

    {

    int a[10][10],b[10][10],c[10][10];

    int i,j,m,n,p,q;

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

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

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

    scanf("%d%d",&p,&q);

    if(m!=p||n!=q)

           {

                printf("Matrix addition not possible.");

                 exit(0);

           }

    printf(" Enter the matrix B values:\n");

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

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

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

    print("Enter the Matrix B values:\n");

    for(i=0;i<p;i )

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

                  c[i][j]=a[i][j] b[i][j];

    printf("\n The Matrix A is \n");

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

                    {

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

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

                        print("\n");

                     }

    printf("\n The Martix B is\n");

    for(i=0;i<p;i )

                {

                for(j=0;j<q;b[i][j]);

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

                printf("\n");

                }

    printf("\n The  Output Matrix C is\n");

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

                 {

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

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

                 printf("\n");

                 }

    }

    OUTPUT :

           Enter the size of Matrix A:2

            3

           Enter the size of Matrix B:2

            3

            Enter the matrix A values:

             1

             2

             3

             4

             5

             6

              Enter the Matrix B values:

              6

              5

              4

              3

              2

              1

     The Matrix A is

    1 2 3

    4 5 6

    The matrix B is

    6 5 4

    3 2 1

    The Output Matrix C is

    7 7 7

    7 7 7

    Users Joined

    ashutosh Kumar jha
    2 days ago
    Sahasra
    3 days ago
    Paman Induja Perera
    1 week ago
    Akram
    1 week ago
    praveen
    1 week ago
    X
    Write a program to perform matrix addition?
    X
    Write a program to perform matrix addition?

    /* ADDITION OF TWO MATRICES*/

    #include<stdio.h>

    #include<conio.h>

    #include<process.h>

    void main( )

    {

    int a[10][10],b[10][10],c[10][10];

    int i,j,m,n,p,q;

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

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

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

    scanf("%d%d",&p,&q);

    if(m!=p||n!=q)

           {

                printf("Matrix addition not possible.");

                 exit(0);

           }

    printf(" Enter the matrix B values:\n");

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

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

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

    print("Enter the Matrix B values:\n");

    for(i=0;i<p;i )

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

                  c[i][j]=a[i][j] b[i][j];

    printf("\n The Matrix A is \n");

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

                    {

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

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

                        print("\n");

                     }

    printf("\n The Martix B is\n");

    for(i=0;i<p;i )

                {

                for(j=0;j<q;b[i][j]);

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

                printf("\n");

                }

    printf("\n The  Output Matrix C is\n");

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

                 {

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

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

                 printf("\n");

                 }

    }

    OUTPUT :

           Enter the size of Matrix A:2

            3

           Enter the size of Matrix B:2

            3

            Enter the matrix A values:

             1

             2

             3

             4

             5

             6

              Enter the Matrix B values:

              6

              5

              4

              3

              2

              1

     The Matrix A is

    1 2 3

    4 5 6

    The matrix B is

    6 5 4

    3 2 1

    The Output Matrix C is

    7 7 7

    7 7 7

    EngineersHub Logo
    x
    Loading...