06Lab Arrays

download 06Lab Arrays

of 1

Transcript of 06Lab Arrays

  • 7/26/2019 06Lab Arrays

    1/1

    Algorithms and Data Structures in C Page 1 of 1

    Lab

    Arrays

    Question 1Write a C program to find the sum of all array elements.

    Example:If the elements of the array are: 1, 2, , !, "Sum of all elements # 1"

    Question 2

    Write a C program that $ill read elements in array and copy all the elements in the firstarray into a second array. %ou program should then display all elements in the first array

    and second array.

    Question 3Write a C program that $ill read elements in an array and count the total num&er of

    negati'e elements in the array. (he program should then display the num&er of negati'e

    elements in the array.

    )e'el 1 Asia Pacific Institute of Information (echnology