#include
#include
#define MAXROWS 10
#define MAXCOLS 10
void main()
{
int A[MAXROWS][MAXCOLS], B[MAXROWS][MAXCOLS], C[MAXROWS][MAXCOLS];
int M, N;
/*Function declarations*/
void readMatrix(int arr[][MAXCOLS], int M, int N);
void printMatrix(int arr[][MAXCOLS], int M, int N);
void productMatrix(int A[][MAXCOLS], int B[][MAXCOLS], int C[][MAXCOLS],
int M, int N);
clrscr();
printf("Enter the value of M and N\n");
scanf("%d %d",&M, &N);
printf ("Enter matrix A\n");
readMatrix(A,M,N);
printf("Matrix A\n");
printMatrix(A,M,N);
printf ("Enter matrix B\n");
readMatrix(B,M,N);
printf("Matrix B\n");
printMatrix(B,M,N);
productMatrix(A,B,C, M,N);
printf ("The product matrix is\n");
printMatrix(C,M,N);
}
/*Input matrix A*/
void readMatrix(int arr[][MAXCOLS], int M, int N)
{
int i, j;
for(i=0; i< M ; i++)
{
for ( j=0; j < N; j++)
{
scanf("%d",&arr[i][j]);
}
}
}
void printMatrix(int arr[][MAXCOLS], int M, int N)
{
int i, j;
for(i=0; i< M ; i++)
{
for ( j=0; j < N; j++)
{
printf("%3d",arr[i][j]);
}
printf("\n");
}
}
/* Multiplication of matrices */
void productMatrix(int A[][MAXCOLS], int B[][MAXCOLS], int C[][MAXCOLS],
int M, int N)
{
int i, j, k;
for(i=0; i< M ; i++)
{
for ( j=0; j < N; j++)
{
C[i][j] = 0 ;
for (k=0; k < N; k++)
{
C[i][j] = C[i][j] + A[i][k] * B[k][j];
}
}
}
}
matrix
just make the matrices upper triangular by making the values below the digonal zero,and then find how many minors can be calcuted.......
i need this answer
printf("%s",per>50?:"pass",per<50?:"fail");
I suggest to use a for loop, more or less like this (assuming the parameter is "n"): product = 1; for (int i = 1; i <= n; i++) { product *= i; }
write a vb program to find the magic square
For first find an example program.
To write a C program to find the adjoint of a matrix, first, you need to create a function to calculate the cofactor of each element in the matrix. Then, construct the adjoint by transposing the cofactor matrix. The program should read the matrix size and elements from user input, compute the cofactors using nested loops, and finally display the adjoint matrix by transposing the cofactor matrix. Make sure to handle memory allocation for dynamic matrices if needed.
Write a program to find the grade obtained by the students of a class
Matrices have a wider application in engineering. Many problems can be transformed in to simultaneous equation and their solution can easily be find with the help of matrices.
Yes, do write. That's what you always have to do when you have got a homework-program.
C Examples on Matrix OperationsA matrix is a rectangular array of numbers or symbols arranged in rows and columns. The following section contains a list of C programs which perform the operations of Addition, Subtraction and Multiplication on the 2 matrices. The section also deals with evaluating the transpose of a given matrix. The transpose of a matrix is the interchange of rows and columns.The section also has programs on finding the trace of 2 matrices, calculating the sum and difference of two matrices. It also has a C program which is used to perform multiplication of a matrix using recursion.C Program to Calculate the Addition or Subtraction & Trace of 2 MatricesC Program to Find the Transpose of a given MatrixC Program to Compute the Product of Two MatricesC Program to Calculate the Sum & Difference of the MatricesC Program to Perform Matrix Multiplication using Recursion