program code is:--
#include %26lt;iostream.h%26gt;
#include %26lt;conio.h%26gt;
{
int a [10] [10],b[10][10],c[10][10];
int i,j,m,n;
cout%26lt;%26lt;"no. of rows";
cin%26gt;%26gt;m;
cout%26lt;%26lt;"no. of columns";
cin%26gt;%26gt;n;
for(i=0;i%26lt;m;i++)
{
for(j=0;j%26lt;n;j++)
{
cout%26lt;%26lt;"enter matrix a["%26lt;%26lt;i+1%26lt;%26lt;"] ["%26lt;%26lt;j+1%26lt;%26lt;"]";
cin%26gt;%26gt; a[i][j];
}
}
for(i=0;i%26lt;m;i++)
{
for(j=0;j%26lt;n;j++)
{
cout%26lt;%26lt;"enter matrix a["%26lt;%26lt;i+1%26lt;%26lt;"] ["%26lt;%26lt;j+1%26lt;%26lt;"]";
cin%26gt;%26gt; b[i][j];
}
}
for(i=0;i%26lt;m;i++)
{
for(j=0;j%26lt;n;j++)
{
c[i] [j] = a[i] [j] + b [i] [j] ;
}
}
cout%26lt;%26lt;" matrix addition is "%26lt;%26lt;end;
for(i=0;i%26lt;m;i++)
{
for(j=0;j%26lt;n;j++)
{
cout%26lt;%26lt; c [ i ] [ j ]%26lt;%26lt;" lt";
}
cout%26lt;%26lt;endl;
}
getch ();
}
How to draw flowchart of matrix addition/multiplication in C-using FOR as nested loop ,any site 4 guidance?
program code is:--
#include %26lt;iostream.h%26gt;
#include %26lt;conio.h%26gt;
{
int a [10] [10],b[10][10],c[10][10];
int i,j,m,n;
cout%26lt;%26lt;"no. of rows";
cin%26gt;%26gt;m;
cout%26lt;%26lt;"no. of columns";
cin%26gt;%26gt;n;
for(i=0;i%26lt;m;i++)
{
for(j=0;j%26lt;n;j++)
{
cout%26lt;%26lt;"enter matrix a["%26lt;%26lt;i+1%26lt;%26lt;"] ["%26lt;%26lt;j+1%26lt;%26lt;"]";
cin%26gt;%26gt; a[i][j];
}
}
for(i=0;i%26lt;m;i++)
{
for(j=0;j%26lt;n;j++)
{
cout%26lt;%26lt;"enter matrix a["%26lt;%26lt;i+1%26lt;%26lt;"] ["%26lt;%26lt;j+1%26lt;%26lt;"]";
cin%26gt;%26gt; b[i][j];
}
}
for(i=0;i%26lt;m;i++)
{
for(j=0;j%26lt;n;j++)
{
c[i] [j] = a[i] [j] + b [i] [j] ;
}
}
cout%26lt;%26lt;" matrix addition is "%26lt;%26lt;end;
for(i=0;i%26lt;m;i++)
{
for(j=0;j%26lt;n;j++)
{
cout%26lt;%26lt; c [ i ] [ j ]%26lt;%26lt;" lt";
}
cout%26lt;%26lt;endl;
}
getch ();
}
cvs
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment