exercise lab1

Upload: muhammadwaqasafridi

Post on 07-Jul-2018

213 views

Category:

Documents


1 download

TRANSCRIPT

  • 8/19/2019 Exercise Lab1

    1/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.

    Ary1  Ary2 

    resultantArray

    1 2 3 4

    5 6 7 8

    9 10 11 12

    13 14 15 16

    1 2 3 4

    5 6 7 8

    9 10 11 12

    13 14 15 16

    2 4 6 8

    10 12 14 16

    18 20 22 24

    26 28 30 32