..

FreePrograms


  CONTACT US   ABOUT US   PRIVACY  DISCLAIMER

FREE C PROGRAMS 

What is C C vs C++ vs Java Program Structure Data Types in C Basic Rules of C & C++
Functions in C If, Else Conditions Loops in C Switch Case Arrays
Pointers Structures in C Strings in C Command Line Arguments Type Casting
Linked Lists Recursion Binary Trees Inheritance Multiple Inheritance
Templates File I/O Object Oriented Programming Data Structures in C C interview Questions

C programming Tutorial : Free C Programs, C Programs Download

Matrix Multiplication C Program

#include<stdio.h>
#include<conio.h>
void main()
{
int a[10][10],b[10][10],c[10][10],i,j,k,m,n,m1,n1;
clrscr();
printf("Enter array size ");
scanf("%d%d",&m,&n);
printf("Enter array size 2");
scanf("%d%d",&m1,&n1);
if(n!=m1)
{
printf("Wrong choice entered");
getch();
exit(0);
}
else
{
printf("Enter elements");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("Enter element 2");
for(i=0;i<m1;i++)
{
for(j=0;j<n1;j++)
{
scanf("%d",&b[i][j]);
}
}
for(i=0;i<m;i++)
{
for(j=0;j<n1;j++)
{
c[i][j]=0;
for(k=0;k<n;k++)
{
c[i][j]=c[i][j]+(a[i][k]*b[k][j]);
}
}
}
printf("REQUIRED MATRIX");
for(i=0;i<m;i++)
{
for(j=0;j<n1;j++)
{
printf("\n%d",c[i][j]);
}
printf("\n");
}
getch();
}
}

COPYRIGHT 2009 ALL RIGHTS RESERVED FREECPROGRAMS.COM