Viewing code of MULTIRAJ
// ------ MULTIRAJ.CPP --------------
//--- Programmed By Rajesh -----
/* Program by rajesh
program to multiply two matrices
*/
#include<stdio.h>
#include<conio.h>
void main(){
int i,j,a[100][100],b[100][100],c[100][100],m,n,o,p,z;
printf("Enter the size of mXn matrix a \n m:");
scanf("%d",&m);
printf("\nn:");
scanf("%d",&n);
printf("Enter the size of oXp matrix b\n:");
scanf("%d",&o);
printf("\n:");
scanf("%d",&p);
/* if else started */
if(n==o){
printf("\t\tEnter the first %dX%d matrix\n",m,n);
for(i=0;i<m;i++){
for(j=0;j<n;j++){
printf("\n:");
scanf("%d",&a[i][j]);
}
}
printf("\n\n\t\tEnter the second %dX%dmatrix\n",o,p);
for(i=0;i<o;i++){
for(j=0;j<p;j++){
printf("\n:");
scanf("%d",&b[i][j]);
}
}
clrscr();
/* prepare a matrix of mXo and reset values of matrix c to zero
*/
for(i=0;i<m;i++) for(j=0;j<o;j++)
c[i][j]=0;
printf("The multiplied matrix is :\n\n");
for(i=0;i<m;i++)
{
for(z=0;z<p;z++)
{
for(j=0;j<n;j++){
c[i][z]+= a[i][j]*b[j][i];
}
}
}
for(i=0;i<m;i++){
for(j=0;j<p;j++)
printf("%d\t",c[i][j]);
printf("\n");
}
/* else closes */
}
else
printf(" Multiplication is impossible for %dX%d matrix and %dX%d matrix",m,n,o,p);
getch();
}
Home
Library Home:
- 1 1111
- 2 AVG_LINE
- 3 Assembly cubing
- 4 EX02_102
- 5 EX02_18
- 6 EX03_10A
- 7 EX03_11A
- 8 EX03_12A
- 9 EX03_9A
- 10 EX18A_R
- 11 EX1_8AR
- 12 EX2_102B
- 13 EX2_102C
- 14 EX2_Q4
- 15 EX3R9A
- 16 EX3_8A
- 17 EXCEQNO4
- 18 EXCSQ6A
- 19 EX_2_102
- 20 EX_CPLUS
- 21 FIB1
- 22 FIB2
- 23 FIB3
- 24 FIBONAC
- 25 FIB_NO_R
- 26 Fibonaci_without ercursion
- 27 MULTIRAJ
- 28 PALINDCT
- 29 PLDRM_N
- 30 Pointer matrix multiply
- 31 RAJ3
- 32 RAJAGE
- 33 RAJMAT1
- 34 RPBROKER
- 35 RPDIGIT
- 36 RPDIGIT1
- 37 RPKILOMETE
- 38 RPOVERTIME
- 39 RPRestaurantBilling
- 40 SRCOMP1
- 41 SRIIMP
- 42 STRUCTCW
- 43 socket programming