WRITE A PROGRAM IN C TO MULTIPLY TWO 2-D ARRAYS
Answers were Sorted based on User's Feedback
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 |
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 |
Answer / abhradeep chatterjee
Shubham Singh's Code is Wrong. Please follow my code for
output.
Is This Answer Correct ? | 5 Yes | 10 No |
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 |
give an example of type casting by a simple c program
what is pointer ? what is the use of pointer?
How can I access memory located at a certain address?
What is the difference between void main and main in c?
what is the associativity of bitwise OR operator?
Write a program that his output 1 12 123
To what value are pointers initialized? 1) NULL 2) Newly allocated memory 3) No action is taken by the compiler to initialize pointers.
What's the total generic pointer type?
What is the use of printf() and scanf() functions?
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference
Can a function argument have default value?
to find the program of matrix multiplication using arrays