-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2.c
41 lines (35 loc) · 781 Bytes
/
2.c
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
40
41
//WAP to perform addition and subtraction of two matrixes.
#include<stdio.h>
void main()
{
int arr1[100],arr2[100],sum[100],sub[100];
int i;
int size;
printf("\nEnter Size of Array:\n");
scanf("%d",&size);
printf("Enter %d Element in 1st Array:\n",size);
for(i=0; i<size; i++)
{
scanf("%d",&arr1[i]);
}
printf("Enter %d Element in 2nd Array:\n",size);
for(i=0; i<size; i++)
{
scanf("%d",&arr2[i]);
}
for(i=0; i<size; i++)
{
sum[i]=arr1[i]+arr2[i];
sub[i]=arr1[i]-arr2[i];
}
printf("\nSum of Array:\n");
for(i=0; i<size; i++)
{
printf("%d\n",sum[i]);
}
printf("Subtarction of Array:\n");
for(i=0; i<size; i++)
{
printf("%d\n",sub[i]);
}
}