WRITE A PROGRAM IN C TO MULTIPLY TWO 2-D ARRAYS

Answers were Sorted based on User's Feedback



WRITE A PROGRAM IN C TO MULTIPLY TWO 2-D ARRAYS..

Answer / shubham singh

#include<conio.h>
#include<stdio.h>
void main()
{
int a[2][2],b[2][2],c[2][2];//declare 3 array int type
int i,j,k;

for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
} scanf("%d",&a[i][j]);//inserting element in array a

}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
} scanf("%d",&b[i][j]);//inserting element in array b

}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
for(k=;k<2;K++)
{
c[i][j]+=a[i][k]*b[i][j];//multiply of a and b
}
}
}

for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("%d",a[i][j]);//printing element of array c
}
}
}//main close

Is This Answer Correct ?    29 Yes 23 No

WRITE A PROGRAM IN C TO MULTIPLY TWO 2-D ARRAYS..

Answer / abhradeep chatterjee

#include<conio.h>
#include<stdio.h>
void main()
{
int a[2][2],b[2][2],c[2][2];//declare 3 array int type
int i,j,k;

for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
} scanf("%d",&a[i][j]);//inserting element in array a

}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
} scanf("%d",&b[i][j]);//inserting element in array b

}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
for(k=;k<2;K++)
{
c[i][j]+=a[i][k]*b[i][j];//multiply of a and b
}
}
}

for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("%d",a[i][j]);//printing element of array c
}
}
}

Is This Answer Correct ?    20 Yes 21 No

WRITE A PROGRAM IN C TO MULTIPLY TWO 2-D ARRAYS..

Answer / abhradeep chatterjee

Shubham Singh's Code is Wrong. Please follow my code for
output.

Is This Answer Correct ?    5 Yes 10 No

WRITE A PROGRAM IN C TO MULTIPLY TWO 2-D ARRAYS..

Answer / akshay sharma

#include<stdio.h>
#include<conio.h>
main()
{
int a[2][2],b[2][2],c[2][2],i,j,k;

for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&a[i][j]);
}
}

for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&b[i][j]);
}
}
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{


c[i][j]=a[i][j]*b[i][j];

}
}

for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("%d",c[i][j]);
}
}
}

Is This Answer Correct ?    10 Yes 18 No

Post New Answer

More C Interview Questions

pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)

0 Answers   Subex,


What is the difference b/w main() in C language and main() in C++.

7 Answers  


What is meant by operator precedence?

0 Answers  


sum of two integers values only other then integer it should print invalid input.

1 Answers  


Can a binary search tree be used as an index? If yes, how? Explain

0 Answers   TCS,






What is file in c preprocessor?

0 Answers  


What are the languages are portable and platform independent?Why they are like that?

1 Answers   Excel, Satyam,


What is a memory leak? How to avoid it?

1 Answers  


Explain union.

0 Answers  


1 1 1 1 2 1 1 3 3 1 1 4 6 4 1

3 Answers  


Write a program in C to reverse a number by recursive function?

1 Answers  


Can we access array using pointer in c language?

0 Answers  


Categories