No products in the cart.

C++ program to find sum of …

CBSE, JEE, NEET, CUET

CBSE, JEE, NEET, CUET

Question Bank, Mock Tests, Exam Papers

NCERT Solutions, Sample Papers, Notes, Videos

C++ program to find sum of two matricses
  • 1 answers

Sia ? 5 years, 5 months ago

  1. #include<iostream>

  2.  

  3. using namespace std;

  4.  

  5. main()

  6. {

  7.    int m, n, c, d, first[10][10], second[10][10], sum[10][10];

  8.    

  9.    cout << "Enter the number of rows and columns of matrix ";

  10.    cin >> m >> n;

  11.    cout << "Enter the elements of first matrix\n";

  12.  

  13.    for (  c = 0 ; c < m ; c++ )

  14.       for ( d = 0 ; d < n ; d++ )

  15.          cin >> first[c][d];

  16.  

  17.    cout << "Enter the elements of second matrix\n";

  18.  

  19.    for ( c = 0 ; c < m ;c++ )

  20.       for ( d = 0 ; d < n ; d++ )

  21.             cin >> second[c][d];

  22.  

  23.    for ( c = 0 ; c < m ; c++ )

  24.       for ( d = 0 ; d < n ; d++ )

  25.          sum[c][d] = first[c][d] + second[c][d];

  26.  

  27.    cout << "Sum of entered matrices:-\n";

  28.  

  29.    for ( c = 0 ; c < m ; c++ )

  30.    {

  31.       for ( d = 0 ; d < n ; d++ )

  32.          cout << sum[c][d] << "\t";

  33.  

  34.       cout << endl;

  35.    }

  36.  

  37.    return 0;

  38. }

http://mycbseguide.com/examin8/

Related Questions

What is mean by buffering in file handling?
  • 1 answers
What are called tokens
  • 2 answers

myCBSEguide App

myCBSEguide

Trusted by 1 Crore+ Students

Test Generator

Test Generator

Create papers online. It's FREE.

CUET Mock Tests

CUET Mock Tests

75,000+ questions to practice only on myCBSEguide app

Download myCBSEguide App