[C++] Adunarea a doua matrici - Tutoriale si exercitii - GAMELIFE România Jump to content

Recommended Posts

Posted
#include <iostream>

using namespace std;

int main()
{
int n,i,j,a[10][10],b[10][10],c[10][10];

cout<<"Introduceti gradul matricei:";
cin>>n;

for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
cout<<"A["<<i<<"]["<<j<<"]=";
cin>>a[i][j];
}}

for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
cout<<"B["<<i<<"]["<<j<<"]=";
cin>>b[i][j];
}}

for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
c[i][j]=a[i][j]+b[i][j];
}}

for(i=1;i<=n;i++){
for(j=1;j<=n;j++)
cout<<c[i][j]<<" ";
cout<<endl;
}
return 0;
}

 

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.


×
×
  • Create New...

Important Information