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

What does. int *x[](); means ?

0 Answers   Wilco,


What does malloc () calloc () realloc () free () do?

0 Answers  


Write a c program to sort six numbers and find the largest one by using the ladder of if-else? plz do help me

2 Answers  


What is the difference between the local variable and global variable in c?

0 Answers  


Is c dynamically typed?

0 Answers  






What is the difference between text and binary modes?

0 Answers  


How can I read in an object file and jump to locations in it?

0 Answers  


What are the advantages and disadvantages of pointers?

0 Answers  


How many types of functions are there in c?

0 Answers  


What is the difference between null pointer and wild pointer?

0 Answers  


Write a C program that defines a 2-dimentional integer array called A [50][50]. Then the elements of this array should randomly be initialized either to 1 or 0. The program should then print out all the elements in the diagonal (i.e. a[0][0], a[1][1],a[2][2], a[3][3], ……..a[49][49]). Finally, print out how many zeros and ones in the diagonal.

3 Answers   Infosys,


Can a pointer be volatile in c?

0 Answers  


Categories