forked from PrabhudeepSingh/C-Programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatrixMultiplication.c
More file actions
39 lines (34 loc) · 842 Bytes
/
MatrixMultiplication.c
File metadata and controls
39 lines (34 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//Program to find product of the respective elements in two dimensional arrays
#include<stdio.h>
int main()
{
int i,n;
float a[20],b[20],c[20];
printf("Enter total number of elements of you want to enter : ");
scanf("%d",&n);
while(n<=0||n>20)
{
printf("\nError... Range of elements is 0 - 20 ");
printf("\nEnter the number of elements again : ");
scanf("%d",&n);
}
printf("\nEnter element of First array : \n");
for(i=0;i<n;i++)
{
printf("Enter the %d element : ",i+1);
scanf("%f",&a[i]);
}
printf("\nEnter element of Second array : \n");
for(i=0;i<n;i++)
{
printf("Enter the %d element : ",i+1);
scanf("%f",&b[i]);
}
printf("\nrespective product of the two array's are : \n");
for(i=0;i<n;i++)
{
c[i]=a[i]*b[i];
printf("%d element is : %.2f\n",i+1,c[i]);
}
return 0;
}