#include<stdio.h>
#include<conio.h>
#include<process.h>
void read_matrix(int x[10][10],int r,int c)
{
int i,j;
for(i=0;i<r;i++)
for(j=0;j<c;j++)
scanf("%d",&x[i][j]);
}
void print_matrix(int x[10][10],int r,int c)
{
int i,j;
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
printf("%d",x[i][j]);
printf("\n");
}
}
void add_matrix(int x[10][10],int y[10][10],int z[10][10],int r,int c)
{
int i,j;
for(i=0;i<r;i++)
for(j=0;j<c;j++)
z[i][j]=x[i][j]+y[i][j];
}
void main()
{
int a[10][10],b[10][10],c[10][10],ra,ca,rb,cb;
clrscr();
printf("Enter order of 2 matrices");
scanf("dd",&ra,&ca,&rb,&cb);
if(ra!=rbca!=cb)
{
printf("addition is not possible");
exit(0);
}
printf("Enter A\n");
printf("Enter B\n");
read_matrix(a,ra,ca);
read_matrix(b,rb,cb);
add_matrix(a,b,c,ra,ca);
print_matrix(c,ra,ca);
getch();
}
By using those two functions in your code.
Matrices can't be "computed" as such; only operations like multiplication, transpose, addition, subtraction, etc., can be done. What can be computed are determinants. If you want to write a program that does operations such as these on matrices, I suggest using a two-dimensional array to store the values in the matrices, and use for-loops to iterate through the values.
matrix
i cant write
trytytytytytytytytrf 6 bcvvtgujhy6
Classes are well organised functions in java which help discriminate between two different functions.
Functions are very important in C++, as you can't write the simplest program to print hello without using a function. Overall you can say that function are building blocks of a C++ program. Functions can also be defined by the programmer to reduce program size.
* * * * * * * * * * write the c++ program and show me brifily?
write ashell script to add awo matrix using array.
how to multiply two sparse matrices
printf("%s",per>50?:"pass",per<50?:"fail");
write a sample program using asp.net explaining all the syntax and semantics of the program