You are on page 1of 2

Week 3

1_D arrays
1. Write a program that read N numbers from the user in an array of integers, then prints the
number of elements that are divisible by 2, 3 and 5.

2. Write a program that read N numbers from the user in an array of integers, then puts even &
odd elements of the array in 2 separate arrays.

3. Write a program to read N numbers from the user in an array of integers, and prints the
following:
a. Sum of all elements.
b. Maximum element.
c. Minimum element.
d. Average of all elements.
e. Numbers above average.
f. Print the array in reverse order.
g. Count the number of occurrences of the first element.

4. Trace the following program:


Assume the user enters the following
values: 9,12,43,6,1,18,76, 6,2,17
2_D arrays
5. Write a program to Read and Print a RxC Matrix, R and C must be input by the user that
represent the number of rows and columns of the matrix.

6. Write a program that reads two 2_arrays of size 3X4 of integers then perform their addition in
a third one and print it.

7. Write a program that reads integer values in a 2_D array of size 2x3 then find its transpose.

8. Trace the following program:


Assume the user enters the following values: Assume the user enters the following values:
9,12,43,6,1,18,76,55,6,2,17,4 1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9

You might also like