C Program to Perform Matrix Operation
This is the C program to perform matrix operations such as addition,division and inverse
[cc lang=”c”]
#include
int mat1[10][10],mat2[10][10],i,j,k,row1,row2,col1,col2,res[10][10];
char ch;
main()
{
printf(“nChoose any Optionn1.Matrix-Additionn2.Matrix-Multiplicationn3.Matrix-Transposen”);
scanf(“%c”,&ch);
switch(ch)
{
case ‘1’:matadd();
break;
case ‘2’:matmul();
break;
case ‘3’:matrans();
break;
default:printf(“nInvalid Optionn”);
}
}
int readmat(void)
{
if(ch==3)
{
printf(“Enter the Rows and Columns of Matrix-1n”);
scanf(“%d%d”,&row1,&col1);
printf(“Enter %dx%d Matrix-1 Array Elements n”,row1,col1);
for(i=0;i
Recent Comments