Upload new file

parent f2e9ecec
#include <algorithm>
#include<iostream>
#include<ctime>
#include<cstdlib>
using namespace std;
int main(){
int n;
cin>>n;
int a[n][n],b[n][n],c[n][n];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{cin>>a[i][j];}
}
for(int i=0;i<n;i++)
{for(int j=0;j<n;j++)
{cin>>b[i][j];}}
for(int i=0;i<n;i++)
{for(int j=0;j<n;j++)
{c[i][j]=0;
for(int k=0;k<n;k++)
{c[i][j]=(c[i][j])+(a[i][k]*b[k][j]);}}}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++)
{cout<<c[i][j]<<" ";}
cout<<"\n";
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment