Exercise Lab1 PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Exercise

Q: Make two 4x4 arrays having names ary1 and ary2. Initialize both the arrays by taking input from user.
Declare a function with the name sumArray .
Pass the two arrays ary1 and ary2 to the function. This function should add the values of the
corresponding cell of the two arrays, and store the result in a new array named resultantArray . Also the
function should display the elements of the resultantArray on the screen.
Consider the two arrays below. Your resultantArray should look like as follow.

1
5
9
13

2
6
10
14

3
7
11
15

4
8
12
16

1
5
9
13

Ary1

Ary2

resultantArray
2
10
18
26

2
6
10
14

4
12
20
28

6
14
22
30

8
16
24
32

3
7
11
15

4
8
12
16

You might also like