Assignment-05: Course No: ME-172
Assignment-05: Course No: ME-172
int main()
{
int a[3][3],i,j,D;
printf("Enter the elements of your
matrix:\n");
for(i=0;i<3;i++)
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
printf("\nThe matrix you entered:");
for(i=0;i<3;i++){
printf("\n");
for(j=0;j<3;j++){
printf("%d\t",a[i][j]);}}
D=a[0][0]*CEM(a,0,0)-a[0]
[1]*CEM(a,0,1)+a[0][2]*CEM(a,0,2);
//CEM=co-efficient matrix
printf("\n\nDeterminant of the
matrix: %d\n\n",D);
return 0;
}
Output:
Matrix multiplication:
Code:
#include<stdio.h>
int main()
{
int a[20][20],b[20][20],c[20]
[20]={0},i,j,k,c1,c2,r1,r2,p,q;
printf("No of columns of
matrix1:");scanf("%d",&c1);
printf("No of rows of
matrix1:");scanf("%d",&r1);
printf("No of columns of
matrix2:");scanf("%d",&c2);
printf("No of rows of
matrix2:");scanf("%d",&r2);
if(c1!=r2)printf("reverse order");
else{
printf("\nEnter the elements of
matrix1:\n");
for(i=0;i<r1;i++)
for(j=0;j<c1;j++)scanf("%d",&a[i]
[j]);
Output: